1,将数组array分成长度为subGroupLength的小数组并返回新数组 function group(array, subGroupLength) { let index = 0; let newArray = []; while(index < array.length) { newArray.push(array.slice(index, index += subGroupLength)); } return newArray; } 2,例如: var Array = [1,2,3,
一.map方法 function fuzzyPlural(single) { var result = single.replace(/o/g, 'e'); //replace也不会修改原来数组的值,这里打印[foot,goose,moose,kangaroo] //alert(single); //下面为新的数组添加了一个元素,但是我们看到在map的时候没有对添加的元素进行处理,所以map调用的结果还是没有变化:["feet", "geese", "me