JS Coding Questions Logo
JS Coding Questions
#201💼 Interview💻 Code

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

Advertisement

728x90

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

javascript
1const object = {
2  a: "Good morning",
3  b: 100,
4  };
5
6for (let value of Object.values(object)) {
7  console.log(`${value}`); // 'Good morning \n100'
8}

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 31

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
201of476
What is the main difference between Object.values and Object.entries method | JSCodingQuestions.com