1 min read 63 words Updated Sep 24, 2026 Created Sep 24, 2026
#JavaScript#TypeScript

The syntax ??called nullish coalescing checks if the left-hand value is nullor undefined. If so, the right hand value is returned.

The condition is not reached for other falsy values. This is what separates this syntax from ||.

Thus, ""and 0are valid values. If an empty string or a a literal zero is on the right hand side, the left-hand value is returned.