In this lesson, you’ll see why you’d want to use the filter()
function rather than, for example, a for loop with an if statement. You’d get the same result, but functional programming allows you to chain function calls. This allows you to avoid side effects and have a line of code that gives you a quick snapshot of what is happening.
When doing functional programming, you have a bunch of functions as your basic building blocks, and then you can use and reuse them together in different contexts.
matt7 on Feb. 20, 2020
You give some very good arguments why the filter style is good in this case. It would help if you could also have a quick discussion on the performance and memory usage impacts of this style of using filter vs. loops/if.