javascript - JSON/JS- Getting JSON object name -


i have following object consisting of 3 other objects of type array :

enter image description here

i want text samsung out of object , rest of objects. have tried using in loop getting keys 0, 1 , 2.

for(brand in brands){  console.log(brand)  // prints out `0, 1 , 2` }  

so added nested in loop, 0, 0, 0 keys within samsung, , other array objects within rest of objects.

what missing ?

you can use object.keys(brands[brand]), and, based on example, want object.keys(brands[brand])[0]


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -