Arrays are a set of values
["a", "b", "c", "d", "e"] is an array.
Each value has an associated index. Index’s start at 0.
var array = ["a", "b", "c", "d", "e"]
Indexes: 0 1 2 3 4
As you can see, the value "c" is associated with the index of 2
To get that element, you would use brackets. First, you have the name of the variable (array), and then you have the brackets with the index inside.
array[0] //The result is "a"
array[2] //The result is "c"
array[4] //The result is "e"
In your case, i starts off at 0, and since i is 0, mainPage[i] is the same as mainPage[0]. Using the index’s I above, you would notice that mainPage[0] is "Home"
You can find out more about Arrays here
0
solved I can’t seem to understand this [closed]