JavaScript & TypeScript

Nullish Coalescing

/ˈnʌlɪʃ kəʊˈæləsɪŋ/

Definition

The ?? operator that returns the right-hand value only when the left side is null or undefined (not falsy).

Example in context

"count ?? 0 returns 0 only if count is null or undefined — count || 0 would also replace zero, which is wrong."

Related terms

Practice this term

Master Nullish Coalescing in context by working through exercises in the JavaScript & TypeScript module. You'll see the term used in real engineering scenarios with multiple-choice, fill-in-the-blank, and matching drills.