Created
December 13, 2020 12:17
-
-
Save mcdollars/1fa0f10a9e0a9994425e0624f05c1657 to your computer and use it in GitHub Desktop.
JS NaN Compare
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const width = NaN; | |
const height = NaN; | |
console.log("NaN == NaN => ", width == height); | |
// NaN == NaN => false | |
console.log("NaN != NaN => ", width != height); | |
// NaN != NaN => true | |
console.log("Object.is(NaN, NaN) => ", Object.is(width, height)); | |
// Object.is(NaN, NaN) => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment