A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/lodash-_-values-method/ below:

Lodash _.values() Method - GeeksforGeeks

Lodash _.values() Method

Last Updated : 25 Oct, 2023

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

Syntax:
_.values(object);
Parameters: Return Value:

This method returns the array of property values of the object element.

Example 1: In this example, we are printing the values of the key by the use of the _.values() method.

JavaScript
// Requiring the lodash library  
const _ = require("lodash");

// The source object
let obj = {
    Name: "GeeksforGeeks",
    password: "gfg@1234",
    username: "your_geeks"
}

// Use of _.values() method 
console.log(_.values(obj)); 

Output:

["GeeksforGeeks", "gfg@1234", "your_geeks"]

Example 2: In this example, we are printing the values of the key by the use of the _.values() method.

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']


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4