JavaScript

Explain the Nullish Coalescing Operator (??)

Medium
2
Added
Returns right-hand operand when left is null/undefined. Unlike ||, it doesn't consider falsy values.

Solution Code

JavaScript
const value = null ?? 'default'; // 'default'
Explanation
Useful for default values without unexpected 0 or '' replacements.

Guided Hints

Compare with logical OR
Browser support