Original Question: Why are two different numbers equal in JavaScript?
I was playing a little with the console and it occurred to me to try the following:
var num1 = 0x100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
var num2 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
console.log(num1 == num2)
And I was surprised that this comparison actually evaluates to true (you can try it on console).
Why is this happening? It is clear that they are different numbers (the second has one digit less than the first; if I add an F to the second or a 0 to the first, the comparison is already false, but in the meantime, it is true).