Open In App

Underscore.js _.isObject() Function

Improve
Improve
Like Article
Like
Save
Share
Report

Underscore.js_.isObject() function is used to check whether the given object is an object or not. It returns a Boolean value True if the given object element is an object and returns False otherwise. JavaScript functions and arrays are objects, while the strings and numbers are not objects.

Syntax:

_.isObject( value );

Parameters:

  • object: This parameter holds the value of the object that needs to be checked whether it is an object or not.

Return Value:

It returns True if the given object element is an object and False otherwise.

Example 1: This example shows the use of the underscore.js _.isObject() function.

html




<!DOCTYPE html>
<html>
 
<head>
    <script type="text/javascript" src=
    </script>
</head>
 
<body>
    <script type="text/javascript">
 
        let info = {
            Company: { name: 'GeeksforGeeks' },
            Contact: {
                Address: {
                    AddressInfo: 'Noida',
                    ContNo: '+91 9876543210'
                }
            }
        };
 
        console.log(_.isObject(info));
    </script>
</body>
 
</html>


Output:

Example 2: This example shows the use of the underscore.js _.isObject() function.

html




<!DOCTYPE html>
<html>
 
<head>
    <script type="text/javascript" src=
    </script>
</head>
 
<body>
    <script type="text/javascript">
 
        console.log(_.isObject(true));
        console.log(_.isObject(1));
        console.log(_.isObject('GeeksforGeeks'));
        console.log(_.isObject([1, 2, 3]));
    </script>
</body>
 
</html>


Output:



Last Updated : 13 Jan, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads