SOURCE

function myNew(ctx,...item){
    let obj = Object.create(null)
    obj._proto_=ctx.prototype
    let res = ctx.call(obj, ...item)
    return (typeof res === 'object' && res != null) ? res : obj;
}
function myInstanceof(left,right){
    let prototype = Object.getPrototypeOf(left)
    while(true){
        if(!prototype)return false
        if(prototype===right.prototype)return true
        prototype = Object.getPrototypeOf(prototype)
    }
}
function myCreate(target){
    function fn(){}
    fn.prototype=target
   fn.prototype.constructor = fn;
   return new fn()
}
function myApply(ctx,item){
    ctx.fn=this
    let res = ctx.fn(...item)
    delete ctx.fn
    return res
}
function myCall(ctx,...item){
    ctx.fn=this
    let res = ctx.fn(...item)
    delete ctx.fn
    return res
}
function myBind(ctx,...item){
    let self =this
    let fnbas = function(){}
    let fn=function(){
        self.apply(ctx,item)
    }
    fnbas.prototype = self.prototype;
    fn.prototype = new fnbas();
    return fn
}
console 命令行工具 X clear

                    
>
console