js數組遍歷數組map(),forEach()及filter()

共同點:javascript 1.都是循環遍歷數組中的每一項。 2.forEach() 和 map() 裏面每一次執行匿名函數都支持3個參數:數組中的當前項item,當前項的索引index,原始數組input。 3.匿名函數中的this都是指Window。 4.只能遍歷數組 1.forEach() //沒有返回值。 let arr = [] //原數組 arr.forEach(funct
相關文章
相關標籤/搜索