Skip to content

Instantly share code, notes, and snippets.

@south37
Created February 11, 2014 08:07
Show Gist options
  • Save south37/8930906 to your computer and use it in GitHub Desktop.
Save south37/8930906 to your computer and use it in GitHub Desktop.
isNaN(NaN); // true
isNaN("foo"); // true
isNaN(undefined); // true
isNaN({}); // true
isNaN({ valueOf: "foo" }); // true
NaN === NaN // falseを返す!!!
function isReallyNaN(x) {
return x !== x; // xがNaNであればtrue, それ以外ではfalse
}
Number.isNaN(NaN); // true
Number.isNaN('NaN'); // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment