Skip to content

Instantly share code, notes, and snippets.

@92hackers
Created August 30, 2017 08:41
Show Gist options
  • Save 92hackers/ae8e3dd89778d8375715b97a0e1d0da2 to your computer and use it in GitHub Desktop.
Save 92hackers/ae8e3dd89778d8375715b97a0e1d0da2 to your computer and use it in GitHub Desktop.
Three kinds of comparisons in Javascript
// 1, Object.is
Object.is('hello', 'hello')
// => true
Object.is(+0, -0)
// => false
Object.is(NaN, NaN)
// => true
// 2, ===
NaN === NaN
// => false
+0 === -0
+0 === 0
// => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment