Search code snippets, questions, articles...

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"
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
default for A
Was this helpful?