You should also have a line like;
let values = [1, 3, 5, 7, 9, 11, 13, 15] ← (will have different values in here.)
So, in setting up the loop, we have;
let i = values.length - 2;
This means the iterator we’re using, i, is going to us the length of the values array, minus 2 as a starting point.
So, in the case of the example above, values has 8 items in it - so that’s its length.
We take 2 off that, so i begins the loop with a value of 6.
i >= 0;
Means we’ll keep looping whilst i is greater than or equal to 0. This is checked at the end of each loop, and we’ll only start a new one if it’s true, otherwise we’ll go on to the next piece of code.
i -= 2
How much we’re changing the iterator with each loop. So, in this case we’re actually subtracting 2 from it each time.
So, for i above, it would start at 6, as described above. Then each time it looped it would minus 2 until it was no longer greater than or equal to 0;
6 then 4 then 2 then 0, then it would stop as i = -2 no longer satisfies the requirement.
Now, inside your loop you have
let a = values[i];
It’s giving a the value that is at index i of the array values.
So, for the example above;
if i is 6, then values[i] would be 13.
Then as we loop through,
i = 4, values[i] = 9,
i = 2, values[i] = 5,
i = 0, values[i] = 1
It’s then using this value for a when making the calculations with total
total = total / a
total = total + 10
Hope this helps