Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

iterate through object javascript

const myObj = {user1: {username: "alvin", id: 1}, user2: {username: "david", id: 2}}

for(let key in myObj){
   console.log(key, myObj[key])
}
// output
// user1 {username: "alvin",id: 1}
// user2 {username: "alvin",id: 1}
Source by zellwk.com #
 
PREVIOUS NEXT
Tagged: #iterate #object #javascript
ADD COMMENT
Topic
Name
2+6 =