潇湘沐
数组:[1, 2, 3, 4]结果:["foo1", "foo2", "foo3", "foo4"]Array.prototype.map() 保留原始阵列const originalArr = ["Iron", "Super", "Ant", "Aqua"];const modifiedArr = originalArr.map(name => `${name}man`);console.log( "Original: %s", originalArr );console.log( "Modified: %s", modifiedArr );Array.prototype.forEach() 覆盖原始数组const originalArr = ["Iron", "Super", "Ant", "Aqua"];originalArr.forEach((name, index) => originalArr[index] = `${name}man`);console.log( "Overridden: %s", originalArr );