Skip to content

Instantly share code, notes, and snippets.

@itrelease
Forked from davejohnson/Array-is-false.js
Created February 15, 2010 11:02
Show Gist options
  • Save itrelease/304556 to your computer and use it in GitHub Desktop.
Save itrelease/304556 to your computer and use it in GitHub Desktop.
[] == false; // true
"" == false; // true
null == false; // false, that's more like it
var a = [];
if (a) {
alert(1); // alert this; in condition need check a.length
} else {
alert(2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment