Why is “0 === -0” true in JavaScript?
问题 In a recent post on http://wtfjs.com/. An author writes following without explanation which happens to be true. 0 === -0 //returns true My understanding about === operator is it returns true if operands point to same object. Also, - operator returns a reference to negative value of operand. With this rule, 0 and -0 should not be the same. So, why is 0 === -0 ? 回答1: In fact, 0 and -0 are not the same even at the bit level. However, there is a special case implemented for +/-0 so they compare