loop through a objet in js code example
Example 1: how to loop object javascript
var obj = {a: 1, b: 2, c: 3};
for (const prop in obj) {
console.log(`obj.${prop} = ${obj[prop]}`);
}
// Salida:
// "obj.a = 1"
// "obj.b = 2"
// "obj.c = 3"
Example 2: loop in object javascript
var person = {"name":"Rasel", age:26};
for (var property in person) {
console.log(person[property]);
}