3 ms·
I have to admit I’m far from a FP guru, very little experience with true functional languages like Haskell etc. For me it’s more a question of style and applyin
by chatmasta 8y ago
I have to admit I’m far from a FP guru, very little experience with true functional languages like Haskell etc. For me it’s more a question of style and applying functional paradigms when possible, eg treating functions as first class citizens, making heavy use of .bind() and passing functions as arguments. I use ES6 via Babel and actually find it to be quite expressive and powerful when used correctly. I just try to keep my functions very small with tight separation of concerns. There are lots of libraries to make JS “more functional,” as the sibling comment alludes to, but I find vanilla JS (or at least ES6) already has many of the features necessary for functional programming, as long as you make the conscious choice to use it that way.
- crooked-v 8y agoIt requires use of Babel, but you might find the function bind operator an interesting alternative to .bind(). https://babeljs.io/docs/plugins/transform-function-bind/ https://babeljs.io/docs/plugins/transform-function-bind/
- chatmasta 8y agoThat’s very cool! But I’d be hesitant to introduce something non-standard into the codebase. Sure the toolchain can handle it but I’d be worried other devs won’t immediately recognize the syntax.