DEV Community

Discussion on: Functional vs Imperative Patterns in JavaScript

Collapse
 
jay97 profile image
Jamal Al

I think functional style is nice but not in all cases. For loops and if statements are part of the language, why would u use external library over something that's already available to u?

Collapse
 
joelnet profile image
JavaScript Joel

You can't be immutable with for loop. If statements also encourage side effects and mutations.

When your code base is all functions, you can create new functions from existing functions.

Composability depends on limiting side effects and preventing mutations.

There are many many benefits that aren't fully realized until you inmerse yourself into an FP codebase.