Test if a value is NaN.
var isnan = require( '@stdlib/utils/is-nan' );
Tests if a value
is NaN
.
var bool = isnan( NaN );
// returns true
-
The function first tests if a
value
isnumeric
before testing if avalue
isNaN
. For non-numeric values, the function returnsfalse
.var bool = isnan( 'NaN' ); // returns false
var isnan = require( '@stdlib/utils/is-nan' );
console.log( isnan( NaN ) );
// returns true
console.log( isnan( '5' ) );
// returns false
console.log( isnan( 5 ) );
// returns false