This:
if (value) {
}
will evaluate to false if value is null
, undefined
, NaN
, an empty string, 0
, or false
.
So you should never need to do any of the following:
if (value == null) {
}
if (value == undefined) {
}
if (value == "") {
}
if (someString.length == 0) {
}
The common JS version of all these is simply
if (value) {
}
It makes for cleaner code and smaller files, too.