Skip to content

Files

Latest commit

8e0d379 · Jan 20, 2025

History

History
16 lines (9 loc) · 523 Bytes

what_is_a_void_operator.md

File metadata and controls

16 lines (9 loc) · 523 Bytes

What is a void operator?

The void operator is used to evaluate an expression and return undefined. It is often used in situations where you want to execute a function or expression but do not care about its result.

Example:

void(0);  // Returns undefined
void(console.log('Hello'));  // Logs 'Hello' and returns undefined

Tags: intermediate, JavaScript, Operators