Member-only story
Functional JavaScript — Creating Functions
JavaScript is partly a functional language.
To learn JavaScript, we got to learn the functional parts of JavaScript.
In this article, we’ll look at how to use the functional programming features in JavaScript.
Pure Function Is a Mathematical Function
Pure functions are mathematical functions.
They exhibit all the same characteristics.
Given the same input, then return one output.
JavaScript and Functional Programming
JavaScript is partly a functional programming language.
It has some of the features, but it also allows us to program it in a non-functional way.
For instance, we can create a function in JavaScript that takes no arguments.
But functions are treated as first-class citizens.
So we can have higher-order functions.
JavaScript Functions
We can create a simple JavaScript function by writing:
() => "foo"
We created an arrow function, which is available only in ES6.