I was learning Objects in Javascript and i use a users example but i have a question.
let users = [
{
"id": "1",
"name": "John",
"age": 20,
"address": "123 Main Street"
},
{
"id": "2",
"name": "Emma",
"age": 23,
"address": "12 Main Street"
}
]
console.log(users[0].id);
In this code, I used users[0] to access John, but John's ID is '1', and I used [0] for array indexing style. So, it feels a bit confusing to me. Is this right, or am I coding it incorrectly? Does it follow a commonly recognized style?
I wanted give IDs to users but index numbers with ID numbers looks weird.