When trying to convert a string containing
not only numbers, but also other characters,
the Number
function will return
the value NaN
:
alert(Number('2s')); // shows NaN
The same effect will bring the use of plus:
alert(+'2s'); // shows NaN