Search code examples
javascriptfor-loopiterationterminology

What is the terminology for the [i] when assigning the results of a for loop iteration to a variable?


Here is the total for loop including the initial array "myArray". I understand the logic for the loop and iteration, but I was wondering the term for the [i] when assigning the results of the loop to a variable or returning the loop.

const myArr = [2, 3, 4, 5, 6];
let total = 0

for (let i = 0; i < myArr.length; i++) {
  total += myArr[i];
}

console.log(total)

I was able to complete the loop. May someone please help to deepen my understanding of the name and meaning of the myArr[i] which I assigned to the total using the addition assignment operator. Does it represent the final result of the loop? Thank you very much! :)


Solution

  • You probably mean Property accessor