Y
Hacker News
new
|
ask
|
show
|
jobs
by
hellcow
856 days ago
Unless you’re testing if something is null or undefined, in which case a single “x != null” handles it.
1 comments
fzzzy
856 days ago
Sure. I usually just use !x for that.
link
SamBam
855 days ago
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
link