JavaScript-关于js数组的笔记 发表于 2019-10-15 更新于 2019-10-23 分类于 JavaScript 记录在 开发中遇到的一些 js 数组的笔记 map 转换数组 The map() method creates a new array with the results of calling a provided function on every element in the calling array. 1234567var array1 = [1, 4, 9, 16];// pass a function to mapconst map1 = array1.map(x => x * 2);console.log(map1);// expected output: Array [2, 8, 18, 32]