bevacqua / es6

:star2: ES6 Overview in 350 Bullet Points

Home Page:https://ponyfoo.com/articles/es6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Object.is and signed zero comparison

alisey opened this issue · comments

Object.is -- like using the === operator programmatically, but also true for NaN vs NaN and +0 vs -0

It's false for +0 vs. -0:

Object.is(+0, -0); // => false
Object.is(-0, -0); // => true

From MDN:

Two values are the same if one of the following holds:
[...]
both numbers and

  • both +0
  • both -0
  • both NaN

Care to PR?

Fixed by #5