04 2021 档案
摘要:1、递归 function deepCope (obj) { // 要拷贝的数据为引用类型属性(数组或对象) if (obj && typeof obj 'object') { const copeObj = Array.isArray(obj) ? [] : {}; // const copeOb
阅读全文
摘要:数组的方法 reduce() reduce方法在数组的每一项元素上都会执行回调函数。 语法:array.reduce( callBack [ , init] ) // 语法arrary.reduce(function(pre, val, ind, arr){ // .... }, init) 回调函
阅读全文
摘要:for 多次遍历代码块 const array = []for (var i = 0; i < 5; i++) { array.push(i)}console.log(array) // [0, 1, 2, 3, 4]const arr = [1, 2, 3] for (let i = 0; i <
阅读全文