SOURCE

Function.prototype.customBind=function(context,...bindArgs){
    //context是要绑定的this
    //bindArgs是传入bind的参数
    const self=this
    return function(...args){
    const newArgs=bindArgs.concat(args)
    return self.apply(context,newArgs)
    }
     

}

function fn(a,b){
   console.log(this,a,b,)
}
fn.customBind({x:100},10,20)()


console 命令行工具 X clear

                    
>
console