how to loop over an object properties code example
Example 1: javascript loop through object properties
for (var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
// do stuff
}
}
Example 2: iterate over array of object javascript and access the properties
for (let item of items) {
console.log(item); // Will display contents of the object inside the array
}