Object.values(obj) is a method in JavaScript that returns an array of the values of an object’s own enumerable properties.
Here is an example of how to use it:
myObj = {
a: 1,
b: 2,
c: 3
};
let values = Object.values(myObj);
console.log(values); // Output: [1, 2, 3]
You can also use Object.values() on an array of objects to extract the values of a specific property.
myArray = [{name: "John", age: 25}, {name: "Mary", age: 22}];
let ages = myArray.map(obj => Object.values(obj)[1]);
console.log(ages); // Output: [25, 22]
Please note that the Object.values() method is supported in modern browsers and Node.js versions from 8.5.0 or higher.
If you need to support older browsers or Node.js versions, you can use a polyfill such as Object.values polyfill by Jordan Harband