0 votes
in JavaScript by
What is the main difference between Object.values and Object.entries method in Javascript?

1 Answer

0 votes
by

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'
  100;
}
...