Favorites

JavaScript void Operator

☕
Enjoying this site?

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

Buy us a coffee
void
JavaScript Unary OperatorThis operator is supported by all modern browsers.
Updated 28th November 2026

The void operator evaluates an expression and then returns undefined.

Description

The void operator evaluates the given expression and returns undefined. It used to appear in href="javascript:void(0)" links, a pattern that should be replaced with real buttons. Today it's mainly used to deliberately ignore a promise in an arrow function, onClick={() => void save()}.

The operand is still evaluated, so any side effects happen; only the result is thrown away. void 0 is a guaranteed way to get undefined, which minifiers use because it's shorter than the word and, in very old environments, undefined could be reassigned.

It's also seen in immediately invoked function expressions, void function () { ... }(), to make the parser treat the function as an expression. In modern code with modules and block scope, those uses are rare, and it's mostly a curiosity you'll recognize in older code or minified output.

Properties

Operator
void
Category
Unary
Precedence
14 (1 is lowest, 18 is highest)
Associativity
right-to-left

Syntax

void expression

Example

console.log(void 0);
console.log(void 'anything');
const fire = () => void Promise.resolve(42);
console.log(fire());

Browser Support

The following information will show you the current browser support for the void 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