js iterate all properties code example
Example 1: js loop through object
for (var property in object) {
if (object.hasOwnProperty(property)) {
// Do things here
}
}
Example 2: javascript iterate through object attributes
for (var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
// do stuff
}
}