Object.entries() function returns an arrau coontaining the object’s key/value pairs. Here’s how you would print out the key/value pairs using
Object.entries() and a
key and the second element is the
Map constructor and
If you convert the iterator that
Object.entries() returns into an array using
Array.from(), you’ll get an array containing the object’s key/value pairs.
Object.keys() function returns an array of the object’s keys, as opposed to both the keys and the values. You can then use square brackets
 to get the object’s values.
Object.entries()? Because you can’t change the value in an entry to change the value in the object.
Object.entries() functions only loop over an object’s own properties. For a POJO, this distinction doesn’t matter. But when you use inheritance, this distinction can be important.
for/in loop lets you iterate over all an object’s keys, including inherited keys.
Generally speaking, you should use
Object.entries() with POJOs to avoid accidentally picking up inheritted properties. But you can use
for/in if you’re sure you want to loop over inheritted properties.