InterviewHubPRO
Section Overview
Q205

Question 205 of 521

Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

39%
JavaScript Internals (521 Qs)•Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

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.

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

  for (let value of Object.values(object)) {
    console.log(`${value}`); // 'Good morning \n100'
  }