Friday, October 10, 2025
HomeLanguagesJavascriptLodash _.values() Method

Lodash _.values() Method

The _.values() method is used to return the array of the own enumerable string keyed property values of the object.

Syntax:

_.values(object)

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

  • object: This parameter holds the object to query.

Return Value: This method returns the array of property values of the object element.

Example 1:

Javascript




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


Output:

["neveropen", "gfg@1234", "your_neveropen"]

Example 2:  

Javascript




// Requiring the lodash library  
const _ = require("lodash");  
  
// The source function
function Fb() {
  this.id = 2045;
  this.username = 'fb_myself';
  this.password = 'fb1234';
}
    
// This will not get included in values array
Fb.prototype.email = 'myself@gmail.com';
  
// Use of _.values() method 
console.log(_.values(new Fb)); 
console.log(_.values('GFG'));


Output:

[2045, "fb_myself", "fb1234"]
['G', 'F', 'G']
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
32350 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6718 POSTS0 COMMENTS
Nicole Veronica
11880 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6838 POSTS0 COMMENTS
Ted Musemwa
7101 POSTS0 COMMENTS
Thapelo Manthata
6794 POSTS0 COMMENTS
Umr Jansen
6794 POSTS0 COMMENTS