The isNaN() function is used to check if a value is not a number.
Syntax
Description: The value to be tested
Example
In this example we use isNaN() to check some values:
false
false
false
false
true
true
Final code and demo is here
Demo
Syntax
isNaN(number)Parameter: number Required.
Description: The value to be tested
Example
In this example we use isNaN() to check some values:
<script type="text/javascript">The output of the code above will be:
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 />");
</script>
false
false
false
false
true
true
Final code and demo is here
Demo
No comments:
Post a Comment