js数组遍历数组map(),forEach()及filter()

共同点:javascript 1.都是循环遍历数组中的每一项。 2.forEach() 和 map() 里面每一次执行匿名函数都支持3个参数:数组中的当前项item,当前项的索引index,原始数组input。 3.匿名函数中的this都是指Window。 4.只能遍历数组 1.forEach() //没有返回值。 let arr = [] //原数组 arr.forEach(funct
相关文章
相关标签/搜索