- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Function Expressions
JavaScript Functions
JavaScript Function Expressions
A JavaScript function expression stores a function inside a variable.
The function is written on the right of an equals sign, and the variable name is used to call it.
Unlike a declaration, a function expression cannot be called before the line that creates it.
Example
Example
javascript
const double = function (number) {
return number * 2;
};
console.log(double(8));In this example, the function has no name of its own.
It is called through the variable double.
