how to loop through an object inside an object code example
Example 1: javascript loop through object
var person = {"name":"bob", age:45};
for (var property in person) {
console.log(person[property]);
}
Example 2: javascript looping through object
for (const [fruit, count] of entries) {
console.log(`There are ${count} ${fruit}s`)
}
// Result
// There are 28 apples
// There are 17 oranges
// There are 54 pears