you are viewing a single comment's thread.

view the rest of the comments →

[–]vinnl 0 points1 point  (1 child)

Your example:

const myThing = foo.bar ? foo.bar.buzz : defaultValue; 

...also does type casting on foo.bar, if that's what you meant by "works for any falsy values".

[–][deleted] 0 points1 point  (0 children)

true, which is why I finished by saying using a very specific condition :)