Last active
December 24, 2015 22:59
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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