JavaScript数组map()方法处理数组 function square(arr) { //为数组 arr 中的每个元素求二次方。不要直接修改数组 arr,结果返回新的数组 return arr.map(x=>x*x); }