Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

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

    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.


    Code:
     const object = {
    a: 'Good morning',
    b: 100
    };
    
    for (let value of Object.values(object)) {
    console.log(`${value}`); // 'Good morning'
    100
    }

Related Topics

Collapse

Working...
X