I'm attempting to iterate over the "users" array and retrieve the value of each "name".
Although the loop seems to be functioning correctly, the value of "name" is returning as "undefined" four times.
JavaScript:
for(var i = 0; i < customer.users.length; i++){
console.log(customer.users.name)
}
JSON:
{
"users":[
{
"user_id": "123",
"name": "test",
"xp_amount": 25
},
{
"user_id": "456 ",
"name": "test1",
"xp_amount": 25
},
{
"user_id": "789",
"name": "test2",
"xp_amount": 25
},
{
"user_id": "101",
"name": "test3",
"xp_amount": 25
}
]
}