In JavaScript, functions are first-class objects: they can be referenced by variables, created as literals, and passed to or returned from other functions. section 5.0 section 5.1.1
This makes functions usable in several places where other values appear:
- Assign a function expression to a variable or property. section 5.1.1
- Pass a function as an argument or return one from another function. section 5.1.1
- Use function methods such as call and apply to choose an invocation context; apply takes arguments in an array, while call takes them individually. section 6.2.4
A function passed as an argument
const myFunc = function(){}; myFunc(function() { return function(){}; }); section 5.1.1







