Wrong example on Array note

As you can see in the image above, the little blue note explaining what is the code doing, is wrong.
It says that the code is calling for the second item in the array and it is not. This may be confusing for most users since it is in the “begginers” lessons

1 Like

Arrays start at 0 in Java script… The first item would be 0 the second item is 1 the example is correct.

Don’t think of it as the number you’re on rather the distance away from the beginning.

Banana is one square away from apple but banana is the second item on the list. So the location of banana is one unit. It takes some getting used to but you’ll get it.

Re read the top section again carefully, it explains how arrays work.

1 Like

Remember that array is indexed at 0. array[0] access the first item in an array. array[1] access the second item in an array.

In the example code below:

var groceries = [
var fruit = groceries[1];

The fruit variable access the second item in groceries array, which is ‘bananas’.

Look at the example carefully. It explains on how array indexing works.

1 Like

I’m a begginer so I didn’t know that↓↓↓

It would be helpful if the note explained this then.

You may want to talk about this to @Grasshopper_Heather or @Grasshopper_Ben.

1 Like

I can’t message them yet, but I’ll do. Thanks for the help!