isnan 

Send to Kindle
home » snippets » javascript » isnan



Snippets

// NaN != NaN and NaN !== NaN
// isNaN(NaN) is true
//
// Note: isNan() coerces it's argument to be a number.  So a value that
//     coerces to a number is not distinguisable from NaN via using isNaN()
//     Ref: 68 Specific Ways to Harness the Power of JavaScript – http://ASIN.cc/Uvpx0f
isNaN("foo")                // true
isNaN(undefined)            // true
isNaN({})                   // true
isNaN({ valueOf: "foo" })   // true