How to use isNaN in JavaScript

This article describe about isNaN() Function in JavaScript.
  • 1986

isNaN() Function in JavaScript

It is define whether a value is an illegal number ( means not a number).

Note: isNaN() function returns true if the value is NaN, otherwise false.

Syntax

isNaN(value)

 

Parameter Description
value Required. to be tested.

Example

<!DOCTYPE html>

<html>

<body>

<script type="text/javascript">

    document.write(isNaN(520) + "<br />");

    document.write(isNaN(-5.20) + "<br />");

    document.write(isNaN(15-5) + "<br />");

    document.write(isNaN(0) + "<br />");

    document.write(isNaN("Hello world") + "<br />");

    document.write(isNaN("2012/08/06") + "<br />");

</script>

</body>

</html>

 

Output

 

pic6.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.