摘要:
function square(arr) { //为数组 arr 中的每个元素求二次方。不要直接修改数组 arr,结果返回新的数组 return arr.map(x=>x*x); } 阅读全文
posted @ 2020-11-02 21:48
WP-WangPin
阅读(162)
评论(0)
推荐(0)
摘要:
function remove(arr, item) { //返回arr中和item不相同的值 return arr.filter(x=>x!==item); } 阅读全文
posted @ 2020-11-02 21:01
WP-WangPin
阅读(2103)
评论(0)
推荐(0)
摘要:
阅读全文
posted @ 2020-11-02 20:39
WP-WangPin
阅读(163)
评论(0)
推荐(0)
摘要:
function sum(arr) { let count=0; arr.forEach(function(x){ count+=x; }) return count; } function sum(arr) { return arr.reduce((a,b)=>a+b,0); } 阅读全文
posted @ 2020-11-02 13:01
WP-WangPin
阅读(252)
评论(0)
推荐(0)

浙公网安备 33010602011771号