javascript

Nullish coalescing operator (??)

The ?? checks if the value on the left is null or undefined and, if it is, will return a supplied value on the right.

const nullValue = null
const valA = nullValue ?? "default for A"
Output
default for A
Was this helpful?