Here is an example:
var a = “hi”;
var b = “123″;
alert(“Variable ‘a’ is not a number.”);
alert(“Variable ‘b’ is not a number.”);
The output will be “Variable ‘a’ is not a number.”
A note to remember: “isNaN() ” will return false for “1e1″ .
I mean, if you have numeric data with the letter ‘e’ in it, then the data is still considered to be numeric!
why is that?
Well, cause it treats the value to be exponential. So if you plan to validate for a numeric field and do not want to allow the letter ‘e’ then remember to validate it separately.