Operators
Nullish coalescing (??)
Returns the left operand except when it is null or undefined, in which case it evaluates the right. Mixing directly with && or || without grouping is invalid syntax.
Formal Syntax & Structure
javascript syntaxjavascript
left ?? rightParameters & Attributes
| Name | Type | Description |
|---|---|---|
| left | expression | Left operand. |
| right | expression | Right operand; short-circuiting may skip evaluation where applicable. |
Return Value
operand value
Result of the operation.
Working Example
Example Snippetjavascript
console.log(0 ?? 7);