SOURCE

function F(){}
F.prototype = null
const obj1 = new F()
const obj2 = myNew(F)

function myNew(obj, ...args) {
    const _obj = {}
    _obj.__proto__ = obj.prototype instanceof Object ? obj.prototype : Object.prototype
    // const _obj = Object.create(obj.prototype) 错误
    obj.call(_obj, ...args)
    return _obj
}

console.log(Object.getPrototypeOf(obj1))
console.log(Object.getPrototypeOf(obj2))
console 命令行工具 X clear

                    
>
console