Favorites

JavaScript => Arrow function Operator

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
=>
JavaScript Other OperatorThis operator is supported by all modern browsers.
Updated 28th November 2026

Arrow functions (=>) are a short way to write functions. They don't have their own this, which makes them convenient for callbacks.

Description

An arrow function is a compact function expression: (a, b) => a + b. With a single parameter the parentheses are optional, and with an expression body the result is returned automatically. A body in braces needs an explicit return, and to return an object literal directly, wrap it in parentheses: () => ({ id: 1 }).

Arrow functions don't have their own this, arguments or super; they use those of the surrounding code. That makes them ideal for callbacks inside methods, but unsuitable as object methods that need this, and they can't be used as constructors.

Arrow functions can be async, async () => { ... }, but not generators. A line break can't come between the parameters and the arrow. Because they're expressions, they're not hoisted like function declarations, so they must be defined before they're called. Their concise syntax makes them the most common choice for callbacks to methods like map(), filter() and addEventListener().

Properties

Operator
=>
Category
Other
Precedence
2 (1 is lowest, 18 is highest)
Associativity
right-to-left

Syntax

(param1, param2) => expression
param => expression
(params) => { statements }

Example

const double = n => n * 2;
const add = (a, b) => a + b;
const makeUser = name => ({ name, created: 2026 });
console.log(double(4), add(2, 3), makeUser('Sam'));

const timer = {
  seconds: 0,
  start() {
    [1, 2, 3].forEach(() => this.seconds++);
    return this.seconds;
  },
};
console.log(timer.start());

Browser Support

The following information will show you the current browser support for the => operator. Hover over a browser icon to see the version that first introduced support for this operator.

This operator is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee