?? vs || (nullish) Playground

A customer hands over a balance of 0, an empty name or null: the || lane and the ?? lane each decide when the fallback is used, and a counting ambil() shows…

Why it matters

Every "give it a default" is a choice between || and ??. Pick wrong and a quantity of 0, an empty string or a false toggle is swallowed by the fallback with no error. It is one of the most common modern JavaScript traps.

The key idea

|| asks "falsy?", ?? asks "null or undefined?"

Common mistakes

Try it in this playground