Skip to content

Instantly share code, notes, and snippets.

@aslushnikov
Last active December 24, 2015 22:59
Show Gist options
  • Save aslushnikov/6876287 to your computer and use it in GitHub Desktop.
Save aslushnikov/6876287 to your computer and use it in GitHub Desktop.
Javascript number trick See http://www.2ality.com/2013/10/safe-integers.html to figure out what's going on
var magic = 10000026136623930;
console.log(magic % 2 === 0); // true
console.log((magic + 1) % 2 === 0); // true... WHAT
// See http://www.2ality.com/2013/10/safe-integers.html
// to figure out what's going on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment