Using Object.keys, Object.values, Object.entries for Object Iteration in Javascript


Iterate through the properties of an object.

Source Code

let obj = { a: 1, b: 2, c: 3 };
Object.keys(obj).forEach(key => {
  console.log(key, obj[key]);
});
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments