DEV Community

Discussion on: Nullish Coalescing - Let Falsy Fool You No More

Collapse
 
lizraeli profile image
Lev Izraelit

Great examples for how valuable the ?? operator is! I think what makes it even better is that we can still use || in the few cases when we want to treat "" and 0 as false. In codebases where this becomes common practice, it will be easy to tell at a glance what values can be expected for the initial variable.

Collapse
 
laurieontech profile image
Laurie

Absolutely. Addition not replacement is key!