The purpose of 'isNaN' is not really to test if something is not a number, but you can use it to test if something is the number NaN (since NaN===NaN returns false in JavaScript you can't use equality).
You should use 'typeof' instead, and then isNaN as:
if((typeof str) === 'number' && !isNaN(str))
Posted On:
26-Sep-2017 02:08