Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Is It Negative Zero (-0)? js

//‘loose’ equality
console.log(+0 == -0); // true

//‘strict’ equality
console.log(+0 === -0); // true

//‘Same-value’ equality (ES2015's Object.is)
console.log(Object.is(+0, -0)); // false

//‘Same-value-zero’ equality (ES2016)
console.log([+0].includes(-0)); // true
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Is #It #Negative #Zero #js
ADD COMMENT
Topic
Name
3+2 =