Answers for "js for each of objects"

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

Code answers related to "Javascript"

Browse Popular Code Answers by Language