数组的遍历方法
2018-04-11 本文已影响0人
lijia069
array.map()
const numbers = [1, 2, 3, 4, 5];
const doubled = numbers.map((number) => number * 2);
console.log(doubled);
遍历数组进行操作,返回由操作结果组成的新数组
const numbers = [1, 2, 3, 4, 5];
const doubled = numbers.map((number) => number * 2);
console.log(doubled);
遍历数组进行操作,返回由操作结果组成的新数组