Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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
Source by masteringjs.io #
 
PREVIOUS NEXT
Tagged: #element #obj #js
ADD COMMENT
Topic
Name
1+2 =