Re:Don't use || to set default values in JavaScript
by kevincennis on Friday July 10, 2015 @08:27AM
(#9863497)
In ES5+, the global `undefined` is immutable, so it should be pretty safe unless someone declared a local `undefined` var in an outer scope.
[ Parent
| on HN ]
Re:Don't use || to set default values in JavaScript
by arnehormann on Friday July 10, 2015 @08:49AM
(#9863617)
I use "var undef;" at the top of a function and never set it to a value. Comparison with === is the same as with undefined. And it's nice for minification.