Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
1wheel
· 12y ago · 0 comments
0 is falsy in javascript; with the second method, default_value will get used instead.
Comments
[–]
elclanrs
12y ago
I'd use:
bar = bar != null ? bar : 'default';