9 points

Mapping an Object


dashboard

Tue May 05 2020 04:59:33 GMT+0000 (UTC)

Posted by @sid #javascript

const object1 = {
  a: 'somestring',
  b: 42
};

for (let [key, value] of Object.entries(object1)) {
  console.log(`${key}: ${value}`);
}
content_copy Copy

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries