javascript's isNaN is a built-in function used to check whether its parameter is a non-numeric value. Its usage syntax is "isNaN(value)", and the parameter value specifies the value to be detected.
The operating environment of this article: Windows 7 system, javascript version 1.8.5, Dell G3 computer.
What is isNaN of javascript?
isNaN() function is used to check whether its argument is a non-numeric value.
If the parameter value is NaN or a non-numeric value such as a string, object, or undefined, it will return true, otherwise it will return false.
Syntax
isNaN(value)
Parameters
value required. The value to detect.
All major browsers support isNaN() function
Example
Check whether the number is illegal:
document.write(isNaN(123)+ "<br>"); document.write(isNaN(-1.23)+ "<br>"); document.write(isNaN(5-2)+ "<br>"); document.write(isNaN(0)+ "<br>"); document.write(isNaN("Hello")+ "<br>"); document.write(isNaN("2005/12/12")+ "<br>");
The output result of the above example:
false false false false true true
Recommended learning: "js Basic Tutorial"
The above is the detailed content of What is isNaN in javascript. For more information, please follow other related articles on the PHP Chinese website!