摘要: Array.prototype.myFind = function(fn) { for(let i=0;i<this.length;i++) { if(fn(this[i])) return this[i] }} let arr = [1,2,3,4,5,6] let targetNum = arr 阅读全文
posted @ 2021-12-07 09:50 有肌肉的小眼睛 阅读(600) 评论(0) 推荐(0)
摘要: let arr = [1,[2,3],[4,5],6]let newArr = []Array.prototype.myFlat = function() { for(let i=0;i<this.length;i++){ if(Array.isArray(this[i])){ this[i].my 阅读全文
posted @ 2021-12-07 09:47 有肌肉的小眼睛 阅读(98) 评论(0) 推荐(0)