js list trhough object code example
Example 1: javascript loop through object
for (var property in object) {
if (object.hasOwnProperty(property)) {
// Do things here
}
}
Example 2: for in loop javascript
var person = {"name":"taylor","age":31};
for (property in person) {
console.log(property,person[property]);
}
//name taylor
//age 31