Last active
December 15, 2015 13:28
-
-
Save danott/5267376 to your computer and use it in GitHub Desktop.
Came across this obscure Firefox bug while building marshill.com/easter.
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
/* In Firefox, all assertions pass except -8 and -9. Wat? Works fine in other browsers encountered */ | |
function assert_equal(a, b) { | |
if (a == b) | |
console.log("TRUE") | |
else | |
console.log("FALSE") | |
} | |
assert_equal(parseInt("-01"), -1); | |
assert_equal(parseInt("-02"), -2); | |
assert_equal(parseInt("-03"), -3); | |
assert_equal(parseInt("-04"), -4); | |
assert_equal(parseInt("-05"), -5); | |
assert_equal(parseInt("-06"), -6); | |
assert_equal(parseInt("-07"), -7); | |
assert_equal(parseInt("-08"), -8); | |
assert_equal(parseInt("-09"), -9); | |
assert_equal(parseInt("-10"), -10); | |
assert_equal(parseInt("-11"), -11); | |
assert_equal(parseInt("-12"), -12); | |
assert_equal(parseInt("-01", 10), -1); | |
assert_equal(parseInt("-02", 10), -2); | |
assert_equal(parseInt("-03", 10), -3); | |
assert_equal(parseInt("-04", 10), -4); | |
assert_equal(parseInt("-05", 10), -5); | |
assert_equal(parseInt("-06", 10), -6); | |
assert_equal(parseInt("-07", 10), -7); | |
assert_equal(parseInt("-08", 10), -8); | |
assert_equal(parseInt("-09", 10), -9); | |
assert_equal(parseInt("-10", 10), -10); | |
assert_equal(parseInt("-11", 10), -11); | |
assert_equal(parseInt("-12", 10), -12); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UPDATE: easily resolvable using the second parameter to pass the base. Still weird that it's inconsistent across browsers.