The Object.fromEntries() method creates an object from an array of key/value pairs.
const fruits = [ [“apples”, 300], [“pears”, 900], [“bananas”, 500] ]; const myObj = Object.fromEntries(fruits); |
Object.values() is similar to Object.entries(), but it returns a one-dimensional array containing the values of the object’s properties.
const person = { firstName : “John”, lastName : “Doe”, age : 50, eyeColor : “blue” }; let text = Object.values(person); |
Object.values() has been supported in all modern browsers since March 2017.