JavaScript

Nullish Coalescing

Definition

The `??` operator that returns the right-hand operand when the left-hand operand is `null` or `undefined`. Unlike `||`, it does not treat `0`, `''`, or `false` as nullish, making it safer for default values.

Code Example

Javascript
Tip: Modify the code above and click “Run” to see the results

Learn More

Related Terms