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.
Software dev at Netflix | DC techie | Conference speaker | egghead Instructor | TC39 Educators Committee | Girls Who Code Facilitator | Board game geek | @laurieontech on twitter
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""
and0
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.Absolutely. Addition not replacement is key!