node js for loop thrhough object code example
Example 1: loop over keys in object javascript
Object.keys(obj).forEach(function(key) {
console.log(key, obj[key]);
});
Example 2: how to loop trough an object java script
const fruits = {
apple: 28,
orange: 17,
pear: 54,
}
const values = Object.values(fruits)
console.log(values) // [28, 17, 54]