摘要:
function instanceOf(left,right) { let proto = left.__proto__; let prototype = right.prototype while(true) { if(proto null) return false if(proto proto 阅读全文
摘要:
function myPromise(constructor){ let self=this; self.status="pending" //定义状态改变前的初始状态 self.value=undefined;//定义状态为resolved的时候的状态 self.reason=undefined; 阅读全文
摘要:
apply Function.prototype.myApply = function(context){ context = context || window context.fn = this var res if(arguments[1]){ res = context.fn(...argu 阅读全文
摘要:
function flatten(arr){ let res = []; arr.map((item)=>{ if(Array.isArray(item)){ res = res.concat(flatten(item)); }else{ res.push(item); } }); return r 阅读全文