Skip to content

Instantly share code, notes, and snippets.

@carlosrojaso
Created May 14, 2014 21:11
Show Gist options
  • Save carlosrojaso/ee9ee82fe6b1798b6db3 to your computer and use it in GitHub Desktop.
Save carlosrojaso/ee9ee82fe6b1798b6db3 to your computer and use it in GitHub Desktop.
JS Comparison operators
// Comparison operators
var foo = 1;
var bar = 0;
var baz = "1";
var bim = 2;
foo == bar; // false
foo != bar; // true
foo == baz; // true; but note that the types are different
foo === baz; // false
foo !== baz; // true
foo === parseInt( baz ); // true
foo > bim; // false
bim > baz; // true
foo <= baz; // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment