DEV Community

Discussion on: Quick tip about || vs ??

brack0 profile image
Denis SOURON • Edited

This is a really nice feature to pull apart nullish and falsy values. I'd love to have this kind of behavior in conditionnal evaluation. Sometimes zero (as number) or empty string are expected values and having to handle nullish versus falsy is not really elegant. Hope this will come soon.

necraidan profile image
Benjamin🦸‍♂️Auzanneau™ Author • Edited

If you want to try it, it's available in TypeScript since the version 3.7 !
In other hand, you can also try it directly in some browsers.
Let's give it a try ! ❓❓