Skip to content
loading...

re: There's no "else if" in JS VIEW POST

TOP OF THREAD FULL DISCUSSION
re: The point I wanted to make was, "if you choose to do FP in your PL of choice you would use filter instead of if"

Unlike Haskell, JavaScript is not a purely functional language. Functions such as filter are recent additions to the language. If you look at the V8 source code for the filter function, you'll see this comment: "The following functions cannot be made efficient on sparse arrays while preserving the semantics."

github.com/v8/v8/blob/73c9be9b31d2...

That’s mostly not a matter of efficiency, it’s all about clean code.

code of conduct - report abuse