Last Updated : 13 Nov, 2023
Lodash _.valuesIn() method is used to return the array of the own and inherited enumerable string keyed property values of object.
Syntax:
_.valuesIn(object)Parameters:
This method accepts a single parameter as mentioned above and described below:
This method returns the array of property values of the object element.
Example 1: In this example, the code employs Lodash's _.valuesIn
method to retrieve and display all property values from the specified object in the console.
// Requiring the lodash library
const _ = require("lodash");
// The source object
let obj = {
Name: "GeeksforGeeks",
password: "gfg@1234",
username: "your_geeks"
}
// Use of _.valuesIn() method
console.log(_.valuesIn(obj));
Output:
["GeeksforGeeks", "gfg@1234", "your_geeks"]
Example 2: In this example, the code uses Lodash's _.valuesIn
method to extract and display all property values, including those from the prototype, of an object created from the Fb
constructor function in the console.
// Requiring the lodash library
const _ = require("lodash");
// The source function
function Fb() {
this.id = 2045;
this.username = 'fb_myself';
this.password = 'fb1234';
}
Fb.prototype.email = 'myself@gmail.com';
// Use of _.valuesIn() method
console.log(_.valuesIn(new Fb));
Output:
[2045, "fb_myself", "fb1234", "myself@gmail.com"]
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