Skip to content
字数
44 字
阅读时间
1 分钟
js
Function.prototype.bind1 = function(){

    const args = Array.prototype.slice.call(arguments)

    const t = args.shift();

    const self = this;

  
  

    return function(){

        return self.apply(t,args)

    }

  

}

  

function fun1(a,b,c){

    console.log('this',this);

    console.log(a,b,c);

    return 'this is fn1'

  
  

}

  

const fun2 = fun1.bind1({obj:100},10,20,31)

fun2()

贡献者

The avatar of contributor named as sunchengzhi sunchengzhi

文件历史

撰写