foreach object javascript
const students = { adam: {age: 20}, kevin: {age: 22}, }; Object.entries(students).forEach(student => { // key: student[0] // value: student[1] console.log(`Student: ${student[0]} is ${student[1].age} years old`); }); /* Output: Student: adam is 20 years old Student: kevin is 22 years old */