Underscore.js _.isNumber() Function

The _.isNumber() function is used to check whether the given object parameter is number or not. If the given object is a number then it returns True value otherwise, it returns False.
Syntax:
_.isNumber( object )
Parameters: This function accepts one parameter as mentioned above and described below:
- object: This parameter holds the object element that need to be check whether it is number or not.
Return Value: It returns True if the given object is number, False otherwise.
Example 1:
<!DOCTYPE html> <html> <head> <script type="text/javascript" src= </script> </head> <body> <script type="text/javascript"> var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; console.log(_.isNumber(arr)); var fun = function (element) { return element % 2 != 0; }; console.log(_.isNumber(fun)); var str = 'zambiatek'; console.log(_.isNumber(str.length)); </script> </body> </html> |
Output:
Example 2:
<!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('zambiatek')); console.log(_.isNumber(15.675)); </script> </body> </html> |
Output:
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!




