赞
踩
Function.prototype.mycall = function (target){
target=target || window;
target.fun = this;
const arg = [...arguments].slice(1);
const rut = target.fun(arg);
delete target.fun;
retuan rut;
}
Function.prototype.mybind = function(content){
if(typeof this !== "function"){
return
}
content = content || window;
let args = [...arguments].slice(1)||""
content.fun = this;
return (function(args){
return function(...b){
let a = [...args,...b]
content.fun(...a)
}
})(args)
}
class MyPromise{ constructor(arg){ this.res; this.rej; this.callThis(); this.value = null; agr(this.res,this.rej); } callThis(){ this.res = this.resolve; this.rej = this.resject; } resolve(success){ this.value = success; } resject(error){ this.value = error; } then(fun){ fun(this.value); } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。