this is what´s happening
typeof Number.parseInt('processed') prints 'number'.
But if Number.parseInt('processed') gives NaN.
this is what´s happening
typeof Number.parseInt('processed') prints 'number'.
But if Number.parseInt('processed') gives NaN.
Number.parseInt('string') returns NaN, which has a type of number.
You can verify it in the browser console:
typeof NaN === 'number'
true
Here's a handy guide on how to test against NaN.
NaN is a value representing Not-A-Number.
Number.parseInt('processed') is NaN
typeof NaN is a number.
The ECMAScript standard states that Numbers should be IEEE-754 floating point data. This includes Infinity, -Infinity, and also NaN.
NaN < 1; // false
NaN > 1; // false
NaN == NaN; // false
Use Number.isNaN() or isNaN() to most clearly determine whether a value is NaN.