The function is a first-class citizen

Functions in JS are essentially objects. So functions can appear anywhere objects can appear.
1. Functions can be variables. You can then call a function from a variable. 2. Functions can be used as arguments. 3. Functions can be returned as values.Copy the code


The essence of closures is higher-order functions that return functions. The return function refers to a variable outside of scope.Copy the code

Pure functions

A pure function is a mathematical concept that describes a mapping in the real world. The characteristic is: give it the same input will always get the same output without exception.Copy the code

Side effects of a function

The side effect of a function is that the same input does not always return the same output. In other words: if a function has side effects, the function must not be pure.Copy the code

Higher-order functions

Higher-order functions are essentially functions. The argument or return value is also a function.Copy the code

Currization of a function

The essence of a function's currization is a higher-order function that takes a function and returns a function. Features are: When a return function is called, it either returns the result of the execution of the parameter function (when the number of parameters passed is exactly the number of parameters of the parameter function), or returns a special function (when the number of parameters of the parameter function is subtracted from the actual number of parameters passed in the call). It is worth noting that this particular function is also a Coriolization function.Copy the code

Function composition

The essence of a function combination is a higher-order function that takes multiple function parameters and returns functions. Features: can combine different fine-grained functions into a more powerful business processing function.Copy the code


Functors are essentially containers with values inside them. All functor containers have map functions. The map function is a higher-order function that takes a function and returns a new functor container. Map's parameter functions are external and are specifically used to change the values inside functors. Based on this design of the functor, the user of the functor can chain-call the map function to process the value inside the functor any number of times. * * * * Functor common Functor/MayBe/Either/IO/Task/MonadCopy the code

Common functional programming aid libraries

 1. lodash
 2. undercore
 3. ramda
Copy the code