Functions

A JavaScript function is a reusable block that receives parameters and returns a value. It is declared with function or, more concisely, with an arrow function =>. Functions are values: they can be stored, passed as arguments, and returned.

Example

const double = (x) => x * 2
double(4)  // 8

Related concepts

The whole glossary