loop object in javascript es6 code example
Example 1: javascript iterate object key values
Object.entries(obj).forEach(([key, value]) => {
console.log(key, value);
});
Example 2: javascript iterate object
for (let key in yourobject) {
if (yourobject.hasOwnProperty(key)) {
console.log(key, yourobject[key]);
}
}