2 ms·
JavaScript is a bad example. We rely on so many libraries which are not functional. React one of the biggest is not functional at all. Also JavaScript biggest
by larsonnn 4y ago
JavaScript is a bad example. We rely on so many libraries which are not functional. React one of the biggest is not functional at all.
Also JavaScript biggest advantage is that you can mix up. And it’s biggest disadvantage is that non experience developers will mix up too.
Also you need to cloning multi level objects.
To work 100% FP in JavaScript you need the libraries and you need to have a flat data structure every where.
I don’t know how many JSON APIs you see who work like that.
JavaScript has also a rich set of language features you can use to save your time and still have quality code.
- weatherlight 4y agoI'm a huge fan of writing code in an FP style in a language where that's the convention. Erlang, Elixir, OCaml, Clojure, (Hell, even Ruby.) The problem with the current state of JS and Its popular libraries, is that the convention is to write OOP and Imperative code. Unless your entire team is onboard, its causes a lot of issues. I feel like js-transpiled languages like Purescript, Rescript, ClojureScript, ReasonML, etc do a really good job of allowing Devs to write functional code on the frontend, while leveraging the JS-lib ecosystem. I personally have a hard time reasoning about while and for loops, etc, and mutable variables, my monkey brain can't keep track of that many spinning plates.