javascript
Filter array
const list = [1,2,3,4,5]
const even_list = list.filter((accumulator,element)=>{
return element % 2 == 0
})
Output
[2,4]
filter() and reduce() will iterate over all the array items, while find() will be faster.
Was this helpful?
Similar Posts
- Javascript ES6 Array Filter
- How to Filter an Array of Objects in React
- Filter an Array using object key value in Javascript
- Javascript Map and Filter together
- filter-Elite software solutions
- Sort array using Array.sort() in javascript
- Break an array into fixed length array groups using lodash in Javascript