Skip to main content
InterviewHubPRO
Section Overview
Q205

Question 205 of 536

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

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

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

junior LevelMost AskedCode ExampleEvent LoopPrototypesData Structures

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'
  }