Open In App

Underscore.js _.isNumber() Function

Underscore.js _.isNumber() function is used to check whether the given object parameter is a number or not. If the given object is a number then it returns True value otherwise, it returns False.

Syntax:

_.isNumber( object );

Parameters:

Return Value:

It returns True if the given object is a number, and False otherwise.



Example 1: This example shows the use of the Underscore.js _.isNumber() Function.




<!DOCTYPE html>
<html>
 
<head>
    <script type="text/javascript" src=
    </script>
</head>
 
<body>
    <script type="text/javascript">
 
        let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
        console.log(_.isNumber(arr));
 
 
        let fun = function (element) {
            return element % 2 != 0;
        };
        console.log(_.isNumber(fun));
 
        let str = 'GeeksforGeeks';
        console.log(_.isNumber(str.length));
    </script>
</body>
 
</html>

Output:



Example 2: This example shows the use of the Underscore.js _.isNumber() Function.




<!DOCTYPE html>
<html>
 
<head>
    <script type="text/javascript" src=
    </script>
</head>
 
<body>
    <script type="text/javascript">
 
        console.log(_.isNumber(true));
        console.log(_.isNumber(10));
        console.log(_.isNumber('GeeksforGeeks'));
        console.log(_.isNumber(15.675));
    </script>
</body>
 
</html>

Output:


Article Tags :