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);
遍历数组进行操作,返回由操作结果组成的新数组