自己实现数组的各种方法
1.reducereduce详解传送门Array.prototype.myReduce = function(fn, initValue) { if (initValue === undefined && !this.length) { throw new Error('myReduce of empty Array with no initial value') } let result = initValue ? initValue : this[0] for
原创
2020-10-14 17:49:45 ·
248 阅读 ·
0 评论