I am using isNan functionto check if entered value is a number:
if(isNaN(num)) {
alert('I am not a number');
}
else {
//
}
However, if entered value is, for example, “5748hh” it is understandable like a number and return false. What is wrong?
from Mozilla MDN
so
alert(isNaN('45345ll'))returns true because its value coercion is different than aparseInt/parseFloatconversion.e.g.
Maybe you get an unexpected value due to a missing paren in your
ifstatement