anol
0
Q:

for each element in object

var obj = {
  first: "John",
  last: "Doe"
};

//
//	Visit non-inherited enumerable keys
//
Object.keys(obj).forEach(function(key) {

  console.log(key, obj[key]);

});
1
Object.keys(object).map(function(objectKey, index) {
    var value = object[objectKey];
    console.log(value);
});
0
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"
0

New to Communities?

Join the community