Skip to content

Instantly share code, notes, and snippets.

@steve54b
Created June 1, 2015 21:33
Show Gist options
  • Save steve54b/8d8b4ebdb701f2076e2c to your computer and use it in GitHub Desktop.
Save steve54b/8d8b4ebdb701f2076e2c to your computer and use it in GitHub Desktop.
As the console output for this code demonstrates, the string "false" evaluates to
boolean false, so it is falsey - and 0 evaluates to 0, which is also regarded as falsey.
var z = 0;
console.log("z = " + z);
var not = "false";
console.log("not = " + not);
console.log("testing z && not");
console.log(z && not);
console.log("testing z || not");
console.log(z || not);
console.log("testing z");
console.log(z);
console.log("testing not");
console.log(not);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment