In general, functions are "subprograms" that can be called from code outside (or inside, in the case of recursion) of the function. Like the program itself, a function consists of a series of statements called the function body. Values can be passed as parameters to functions and functions return values.
In JavaScript, functions are first-class objects, because they can be passed to other functions, returned from functions, and assigned to variables and properties. They can also have properties and methods just like any other object. What distinguishes them from other objects is that functions can be called.
Here are some types of functions in javascript.
First-order function
Unary function
Pure function
Currying function