JavaScript · Senior · Question 60 of 75
What does Object.is(-0, 0) return, and why does it exist?
- ✓Correct answer:
false- it distinguishes-0and+0, and treatsNaNas equal to itself - 2
true, same as=== - 3It throws for numbers
Explanation
React and other libraries use Object.is to compare state. === says -0 === 0 and NaN !== NaN.