Skip to content

Instantly share code, notes, and snippets.

@ninjadev11
Created December 13, 2020 12:17
Show Gist options
  • Save ninjadev11/1fa0f10a9e0a9994425e0624f05c1657 to your computer and use it in GitHub Desktop.
Save ninjadev11/1fa0f10a9e0a9994425e0624f05c1657 to your computer and use it in GitHub Desktop.
JS NaN Compare
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