DEV Community

Discussion on: Is JavaScript truly a functional language?

Collapse
 
sergix profile image
Peyton McGinnis • Edited

It's a combination of both.

Functional programming is a programming paradigm: it's a specific way of writing code, where you follow certain rules.

You can write functional programs in many object-oriented languages, such as JavaScript and Python, but these programs aren't truly functional since their constructs don't fully mesh with the framework and rules of functional programming.

That's where languages like Haskell and Clojure come in — these are purely functional programming languages that do not have the traditional OOP constructs, and force the functional programming paradigm's rules, such as never mutating state directly and always keeping functions pure.

But yes, functional programming is essentially the composition of pure functions. Rather than telling the computer how to do something, you define what the program is to do.