Im trying to understand how arrays work. I cannot seem to access certain keys in an array. the array is
const array = [
{
username: "john",
team: "red",
score: 5,
items: ["ball", "book", "pen"]
},
{
username: "becky",
team: "blue",
score: 10,
items: ["tape", "backpack", "pen"]
}];
I tried to console.log(array.username) and also (this.array.username) and all the array['username'] variations. But it always returns undefined (or returns "cannot read property username of undefined." But when i use "console.log (array[0].username)" it gives me the value.
so how can I access (or console.log) all the value of the "username" keys, without using an exact point like (array[0][1])?