Arrow Function (JavaScript)

An arrow function is a short syntax for writing JavaScript functions using =>. Single-expression arrows return their value automatically.

JavaScript

Syntax

const name = (params) => expression

Examples

JavaScript

const add = (a, b) => a + b;
console.log(add(2, 3));

Output:

5

See also

Back to the Dictionary