๐ฎArray.filter()
filter()
filter
method will return a brand new array with elements that returned true
_ _from the function provided. Notice that in the example above, the function passed into the filter method returns true
if element is odd which is why you see that filteredArray
is [1, 3]
.
Note
: filter method doesnโt mutate the original array. It will create a new array.
Last updated