DEV Community

Discussion on: There's no "else if" in JS

 
kayis profile image
K

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"

Thread Thread
 
nathank887 profile image
Nathan

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...