JavaScript call apply bind

2019-02-24  本文已影响0人  尘封丿History

Function.prototype.myCall=function(context){

if(typeof this !=='function'){

throw new TypeError('error');

}

context = context||window;

context.fn=this;

let args = [...arguments].slice(1);

let ruselt=context.fn(args);

delete context.fn

return result;

}

上一篇下一篇

猜你喜欢

热点阅读