loop through object elements javascript code example
Example 1: javascript loop through object
Object.entries(obj).forEach(
([key, value]) => console.log(key, value)
);
Example 2: js loop through object
for (var property in object) {
if (object.hasOwnProperty(property)) {
// Do things here
}
}