Skip to content

Instantly share code, notes, and snippets.

@mackenco
Created December 7, 2015 20:58
Show Gist options
  • Save mackenco/bc9ef211c999567966a6 to your computer and use it in GitHub Desktop.
Save mackenco/bc9ef211c999567966a6 to your computer and use it in GitHub Desktop.
Some FUN equality tests
var num1 = true;
if (num1) {
console.log("number 1");
}
var num2 = false;
if (num2) {
console.log("number 2");
}
var num3 = "true";
if (num3) {
console.log("number 3");
}
var num4 = "false";
if (num4) {
console.log("number 4");
}
var num5 = null;
if (num5) {
console.log("number 5");
}
var num6 = undefined;
if (num6) {
console.log("number 6");
}
var num7 = "Daniel Lin";
if (num7) {
console.log("number 7");
}
var num8 = 9000;
if (num8) {
console.log("number 8");
}
var num9 = 1;
if (num9) {
console.log("number 9");
}
var num10 = 0;
if (num10) {
console.log("number 10");
}
var num11 = NaN;
if (num11) {
console.log("number 11");
}
var num12 = "NaN";
if (num12) {
console.log("number 12");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment