traverse object js code example
Example 1: iterate object js
for (let key in yourobject) {
if (yourobject.hasOwnProperty(key)) {
console.log(key, yourobject[key]);
}
}
Example 2: object traversal javascript
for (var prop in obj) {
obj[prop] = 'xxx';
}