Why Use the filter() Function?
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.
Comments & Discussion
Become a Member to join the conversation.