Answers for "for each object inside object"

1

for each element in obj js

// Easy access to key and value :)
let myObj = {name: 'Jojo', family: 'Lopez'}

for (const [key, value] of Object.entries(myObj)) {
  console.log('key is:', key);
  console.log('value is:', value);
}

// key is: name
// value is: Jojo
// key is: family
// value is: Lopez
Posted by: Guest on January-14-2022
0

for each of object

Object.keys(object).map(function(objectKey, index) {
    var value = object[objectKey];
    console.log(value);
});
Posted by: Guest on October-29-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language