05 2020 档案
摘要:let arr = [1, 2, [3, 4], [[5, 6], 7, [8, [9]]]] function flatten1(arr) { let res = []; arr.forEach(item => { res = res.concat(Array.isArray(item) ? fl
阅读全文
摘要:```//冒泡bubblefunction bubbleSort(arr) { let l = arr.length; for (let i = 0; i arr[j + 1]) { [arr[j], arr[j + 1]] = [arr[j + 1], arr[j]] } } } return arr;}//插入insertfunction insertS...
阅读全文
摘要:```Array.prototype.customMap = function (fn) { let newArr = []; for (let i = 0, l = this.length; i 0) { t = this[i]; this[i] = this[j]; this[j] = t; } } }}Array.protot...
阅读全文