Ironically, JavaScript is not a particularly good FP language. (Many FP purists don’t even consider JavaScript a FP language.) JavaScript is primarily a procedural language with some functional and object-oriented capabilities tacked on. Enforcement of immutability is not part of the language (but as you said, there’s a library for that).

  • Avoid shared state
  • Avoid mutating state
  • Avoid side effects

No language enforcement for these. It’s really done by convention and discipline, which you can also do in other languages like Java and Smalltalk.

In fact, the defining quality of any and all FP languages is the presence of first-class functions and closures. Everything else is notation. Even immutability is not a strict requirement in many FP languages. So it would not be unreasonable to call Smalltalk a FP language! (Did you know that Smalltalk has methods for map and reduce?)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store