Closed tasawar-hussain closed 3 years ago
Filter() and Reduce() both have their own advantages. filter() creates a new array by removing elements that don't belong. reduce(), on the other hand, takes all of the elements in an array and reduces them into a single value.
Add alternate solution using
filter
, which is more readable and intended for filtering