FrontendDeveloper.in

JavaScript question detail

What is the main difference between Object.values and Object.entries method

The Object.values() method's behavior is similar to Object.entries() method but it returns an array of values instead [key,value] pairs.

const object = {
a: "Good morning",
b: 100,
};

for (let value of Object.values(object)) {
console.log(`${value}`); // 'Good morning \n100'
}
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399