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.

Frequently Asked Questions

What does "Nullish Coalescing" mean?

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

How do you pronounce "Nullish Coalescing"?

"Nullish Coalescing" is pronounced /ˈnʌlɪʃ kəʊˈæləsɪŋ/.

Can you use "Nullish Coalescing" in a sentence?

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