javascript - JSON/JS- Getting JSON object name -
i have following object consisting of 3 other objects of type array :

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
Post a Comment