Skip to content

Glossary: JavaScript Beyond the Basics

?? (nullish coalescing)

Also written: nullish coalescing, nullish coalescing operator

The `??` operator gives its right side only when its left side is `null` or `undefined`. Unlike `||`, it keeps values such as `0`, so a quantity of 0 stays 0.

Where the book teaches it

Related terms

?. (optional chaining)