🔥 Burn Fat Fast. Discover How! 💪

2. What is functional programming? Functional programming pro | Coding interview preparation

2. What is functional programming?

Functional programming produces programs by composing mathematical functions and avoids shared state & mutable data. Lisp (specified in 1958) was among the first languages to support functional programming, and was heavily inspired by lambda calculus. Lisp and many Lisp family languages are still in common use today.

Functional programming is an essential concept in JavaScript (one of the two pillars of JavaScript). Several common functional utilities were added to JavaScript in ES5.

Good to hear:

Pure functions / function purity.
Avoid side-effects.
Simple function composition.
Examples of functional languages: Lisp, ML, Haskell, Erlang, Clojure, Elm, F Sharp, OCaml, etc…
Mention of features that support FP: first-class functions, higher order functions, functions as arguments/values.

Red flags:

No mention of pure functions / avoiding side-effects.
Unable to provide examples of functional programming languages.
Unable to identify the features of JavaScript that enable FP.

#javascript #js