摘要:
Array.prototype.myReduce = function(fn,initValue){ if(this.length == 0){ throw new Error('Reduce of empty array with no initial value') } let i,total; 阅读全文
posted @ 2020-07-24 22:35
671_MrSix
阅读(91)
评论(0)
推荐(0)
摘要:
Array.prototype.myFilter = function(callback){ let arr = [] for(let i = 0;i < this.length;i++){ let item = this[i] if(callback(item,i,this)){ arr.push 阅读全文
posted @ 2020-07-24 21:30
671_MrSix
阅读(86)
评论(0)
推荐(0)
摘要:
const EventUtils = { addEvent(element,type,handler){ if(element.addEventListener){ element.addEventListener(type,handler,false) }else if(element.attac 阅读全文
posted @ 2020-07-24 21:23
671_MrSix
阅读(117)
评论(0)
推荐(0)
摘要:
Array.prototype.myMap = function(callback){ let arr = new Array(this.length) for(let i = 0;i < this.length;i++){ let item = this[i] if(this.indexOf(it 阅读全文
posted @ 2020-07-24 18:09
671_MrSix
阅读(120)
评论(0)
推荐(0)