1234567891011
Function.prototype.myCall = function (context,...args) { var context = context || window; context.fn=this; var res=(args!=null&&args!=undefined)?context.fn(...args):context.fn(); delete context.fn; return res;}function test(){ console.log(this);}test.myCall({name:'lili'});
1234567
Function.prototype.myBind=function(obj,...args){ obj=obj||windows; fn=this; return function(params){ fn.apply(obj,params); }}