DEV Community

Discussion on: Quick tip about || vs ??

Collapse
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.

Collapse
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.
dev-to-uploads.s3.amazonaws.com/i/...
Let's give it a try ! ❓❓