JS數組中的filter方法

filter方法 ①filter方法能夠遍歷數組 ②filter方法的參數是函數 ③filter方法函數有形參v ④形參v指的是數組中每一個元素 ⑤filter方法中函數有返回值(把符合條件的元素放在一個新數組中返回) 示例:web const arr = [1,2,3].filter((v)= > { console.log(v); //輸出爲1,2,3 return v>
相關文章
相關標籤/搜索