Functions

First-class function value

Try the free JavaScript compiler

Function objects can be stored, passed as arguments and returned. Assigning an alias does not run the function or create a new function object.

Formal Syntax & Structure

javascript syntaxjavascript
const alias = callable;

Working Example

Example Snippetjavascript
function f(){return 4;}const g=f;console.log(f===g,g());
JavaScript Reference