數組遍歷forEach、map、filter、find、some、every、reduce等區別

forEach() map()----更新數組 filter()、includes()、find()、findIndex()----篩選(刪除)數組 some()、every()----判斷數組 reduce()----疊加數組 arr.forEach() 遍歷數組所有元素,利用回調函數對數組進行操做,自動遍歷數組.length次,且沒法break中途跳出循環,不可控javascript 不支持r
相關文章
相關標籤/搜索