Skip to content

Instantly share code, notes, and snippets.

@formatkaka
Created August 17, 2017 19:16
Show Gist options
  • Save formatkaka/b5cdfb9cba4b33807845fb19a89d4944 to your computer and use it in GitHub Desktop.
Save formatkaka/b5cdfb9cba4b33807845fb19a89d4944 to your computer and use it in GitHub Desktop.
// if both values in the < comparison are strings,
// the comparison is made lexicographically (aka alphabetically like
// a dictionary). But if one or both is not a string,
// then both values are coerced to be numbers, and a typical numeric
// comparison occurs.
var a = 41;
var b = "42";
var c = "43";
a < b; // true
b < c; // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment