javascript loop over properties of object code example
Example 1: js loop over object
const object = {a: 1, b: 2, c: 3};
for (const property in object) {
console.log(`${property}: ${object[property]}`);
}
Example 2: iterate over object javascript
// For a functional one-liner
Object.keys(pokemons).forEach(console.log);
// Bulbasaur
// Charmander
// Squirtle
// Pikachu