Open In App

Underscore.js _.isNaN() Function

_.isNaN() function: 

Syntax: 



_.isNaN(object)

Parameters:
It takes only one argument which is the object that needs to be checked.
Return value:
It returns true if the object’s value is NaN otherwise it returns false.
Examples:




<!-- Write HTML code here -->
<html>
  
<head>
    <script src =
    </script>
</head>
  
<body>
    <script type="text/javascript">
        var a=10;
        console.log(_.isNaN(10));
    </script>
</body>
  
</html>

Output:






<!-- Write HTML code here -->
<html>
   
<head>
    <script src =
    </script>
</head>
   
<body>
    <script type="text/javascript">
        console.log(_.isNaN(NaN));
    </script>
</body>
   
</html>

Output:




<!-- Write HTML code here -->
<html>
   
<head>
    <script src =
    </script>
</head>
   
<body>
    <script type="text/javascript">
        console.log(_.isNaN(undefined));
    </script>
</body>
   
</html>

Output:




<!-- Write HTML code here -->
<html>
   
<head>
    <script src =
    </script>
</head>
   
<body>
    <script type="text/javascript">
        var a = _.isNaN(undefined);
        var b = _.isNaN(NaN);
        var c = a + b;
        console.log(a);
        console.log(b);
        console.log(c);
    </script>
</body>
   
</html>

Output:

NOTE: 
These commands will not work in Google console or in firefox as for these additional files need to be added which they didn’t have added.
So, add the given links to your HTML file and then run them. 
The links are as follows:
 




<!-- Write HTML code here -->
<script type="text/javascript" src =
</script>


Article Tags :