Skip to content
Related Articles

Related Articles

JavaScript isNaN() Function
  • Last Updated : 17 Dec, 2020

The isNaN() function is used to check whether a given value is an illegal number or not. It returns true if value is a NaN else returns false. It is different from the Number.isNaN() Method.

Syntax:

isNaN( value )

Parameter Values: This method accepts single parameter as mentioned above and described below:

  • value: It is a required value passed in the isNaN() function.

Return Value: It returns a Boolean value i.e. returns true if the value is NaN else returns false.

Javascript




<script>
    document.write(isNaN(12) + "<br>");
    document.write(isNaN(0 / 0) + "<br>");
    document.write(isNaN(12.3) + "<br>");
    document.write(isNaN("Geeks") + "<br>");
    document.write(isNaN("13/12/2020") + "<br>");
    document.write(isNaN(-46) + "<br>");
    document.write(isNaN(NaN) + "<br>");
</script>

Output:

false
true
false
true
true
false
true

Supported Browsers:

  • Chrome
  • Firefox
  • Edge
  • Opera
  • Safari
My Personal Notes arrow_drop_up
Recommended Articles
Page :