The .filter() Method (iterators)
Tue Oct 05 2021 12:49:17 GMT+0000 (UTC)
Saved by @ianvalentino #javascript #method
Another useful iterator method is .filter(). Like .map(), .filter() returns a new array. However, .filter() returns an array of elements after filtering out certain elements from the original array. The callback function for the .filter() method should return true or false depending on the element that is passed to it. The elements that cause the callback function to return true are added to the new array.
https://www.codecademy.com/courses/introduction-to-javascript/lessons/javascript-iterators/exercises/filter
Comments