each js object code example
Example 1: js object for each
const obj = {
a: 1,
b: 2,
c: 3
};
for (let key in obj) {
console.log(key + " = " + obj[key]);
}
// Ausgabe:
// "a = 1"
// "b = 2"
// "c = 3"
Example 2: for each of object
Object.keys(object).map(function(objectKey, index) {
var value = object[objectKey];
console.log(value);
});