When people write
if (foo==null)
OR
if (!foo)
To check if something exists, they really meant to write
if ((typeof foo)=='undefined')
You can't check for a property existing by coercing into a boolean. That's horrible. What if it does exist, and holds a boolean.
When people write
if (foo==null)
OR
if (!foo)
To check if something exists, they really meant to write
if ((typeof foo)=='undefined')
You can't check for a property existing by coercing into a boolean. That's horrible. What if it does exist, and holds a boolean.