Friday, January 16, 2026
HomeLanguagesJavascriptLodash _.isObjectLike() Method

Lodash _.isObjectLike() Method

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

The _.isObjectLike() method is used to find whether the given value is an object-like or not. It returns a True if the given value is object-like which means if it’s not null and has a type of the result of “object”. Otherwise, it returns false.  

Syntax:

_.isObjectLike(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 object-like, else false.

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

Example 1:




   
// Requiring the lodash library  
const _ = require("lodash");  
  
// Use of _.isObjectLike() method 
// When the value declare as an object  
console.log(_.isObjectLike({})); 
  
// When the value is null
console.log(_.isObjectLike(null)); 


Output:

true
false

Example 2:




// Requiring the lodash library  
const _ = require("lodash");  
  
// Array object
let arr = [1, 2, 3];
  
// Use of _.isObjectLike() method 
console.log(_.isObjectLike(arr));


Output:

true

Example 3:  




// Requiring the lodash library  
const _ = require("lodash");  
  
// The source object
var info = { 
            Name: "neveropen"
            password: "gfg@1234"
            username: "your_neveropen"
        }
  
// Use of _.isObjectLike() method 
console.log(_.isObjectLike(info));


Output:

true

Note: This code will not work in normal JavaScript because it requires the library lodash to be installed.

Reference: https://lodash.com/docs/4.17.15#isObjectLike

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen 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!
RELATED ARTICLES

Most Popular

Dominic
32474 POSTS0 COMMENTS
Milvus
117 POSTS0 COMMENTS
Nango Kala
6846 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12061 POSTS0 COMMENTS
Shaida Kate Naidoo
6984 POSTS0 COMMENTS
Ted Musemwa
7219 POSTS0 COMMENTS
Thapelo Manthata
6933 POSTS0 COMMENTS
Umr Jansen
6911 POSTS0 COMMENTS