Hacker News new | ask | show | jobs
by fzzzy 856 days ago
Sure. I usually just use !x for that.
1 comments

That doesn't test if it's null or undefined, that just tests if it's not falsy.

x = 0; !x → true

y = ""; !y → true

z = null; !z → true