Hacker News new | ask | show | jobs
by 1wheel 4545 days ago
0 is falsy in javascript; with the second method, default_value will get used instead.
1 comments

I'd use:

  bar = bar != null ? bar : 'default';