This is the quiz for today...
a === b gives true
yet if you use them for the same operation, they give different results.
What are they?
The answer is...
Scroll down to see it...
Or do you want more times to think about it.
It is not a trick question.
...
...
...
And the answer is
const a = 0, b = -0;
console.log(a === b); // gives true
but 1 / a
and 1 / b
give different results.
The first one is Infinity
. The second one is -Infinity
.
The results are not just different, but very different.
Top comments (0)