摘要:
Array.prototype.myReduce = function(fn,initValue){ if(this.length == 0){ throw new Error('Reduce of empty array with no initial value') } let i,total; 阅读全文
摘要:
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 阅读全文
摘要:
const EventUtils = { addEvent(element,type,handler){ if(element.addEventListener){ element.addEventListener(type,handler,false) }else if(element.attac 阅读全文
摘要:
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 阅读全文