Skip to content
Related Articles

Related Articles

Lodash _.isObject() Method
  • Last Updated : 05 Sep, 2020

Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc.

The _.isObject() method is used to find whether the given value is an object or not. It returns a Boolean value True if the given value parameter is an object and returns False otherwise. 

Syntax:

_.isObject(value)

Parameters: This method accepts a single parameter as mentioned above and described below:

  • value: This parameter holds the value to check.

Return Value: This method returns true if the value is an object, else false.



Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library into the file.

Javascript




// Requiring the lodash library  
const _ = require("lodash");  
     
// Use of _.isObject()  
// method 
  
console.log(_.isObject('GeeksforGeeks')); 
console.log(_.isObject(1)); 
console.log(_.isObject([1, 2, 3]));

Output:

false
false
true

Example 2:  

Javascript




// Requiring the lodash library  
const _ = require("lodash");  
     
// Use of _.isObject()  
// method 
  
console.log(_.isObject({})); 
console.log(_.isObject(null)); 
console.log(_.isObject(_.noop)); 

Output:

true
false
true
My Personal Notes arrow_drop_up
Recommended Articles
Page :