Number.isFinite()
Value is used to check whether a limited (finite), whether there is a finite number (finite number), i.e. notInfinity
If the parameter type is not a value, Number.isFinite
shall be returnedfalse
Number.isFinite(NaN); // false Number.isFinite(Infinity); // false Number.isFinite(-Infinity); // false Number.isFinite('foo'); // false Number.isFinite('15'); // false Number.isFinite(true); // false
Number.isFinite(0); // true Number.isFinite(2e64); // true Number.isFinite(0.8); // true
Number.isNaN()
Used to check whether a value NaN
.
If the parameter type is not NaN
, Number.isNaN
shall be returned false
.
isNaN (to true); // to false isNaN (null); // to false isNaN (37 [); // to false // strings isNaN ( "37 ["); // to false: the value may be converted into 37 [ isNaN ( "37.37") ; // false: the value may be converted into 37.37 isNaN ( ""); // false: the empty string is converted into 0 isNaN ( ""); // false: the string is converted into the spaces 0 // a dates isNaN (new Date ()); // false
isNaN (NaN3); // to true isNaN (undefined); // to true isNaN ({}); // to true isNaN ( "37,5"); // to true isNaN (new new a Date () toString ().); / / to true isNaN ( "blabla") // to true: "blabla" // value that can not be converted into numerical fails, the return NaN3 Number.isNaN (. 9 / NaN3) to true // Number.isNaN ( 'to true' / 0) / / to true Number.isNaN ( 'to true' / 'to true') to true //