var arr=[1,2,3,4] arr.forEach((res)=>{return res+1}) undefined arr //[1,2,3,4] arr.map((res)=>{return res=res+1}) [2, 3, 4, 5] arr //[1,2,3,4]
foreach没有返回值
map会返回一个新的数组 不会修改原来的数组
var arr=[1,2,3,4] arr.forEach((res)=>{return res+1}) undefined arr //[1,2,3,4] arr.map((res)=>{return res=res+1}) [2, 3, 4, 5] arr //[1,2,3,4]
foreach没有返回值
map会返回一个新的数组 不会修改原来的数组
https://github.com/ddean2009/blog-auto-publishing-tools
一. 二. 三. ! 作 者 : Yaopengfei(姚鵬飛) 博客地址 : http://www.cnblogs.com
ERROR Failed to compile with 1 error