The i is a variable. In a for loop, you have the following syntax:
for(initialization; condition; update) {
// for loop body
}
The for loop will begin by running the initialization portion first, which in this case declares the variable i with an initial value of 0. Before each iteration of the loop, condition is checked and the loop body will run as long as condition is true. Then, after the loop body runs, update will run. In this case, the variable i will have its value incremented by 1, i.e. i++ is basically the same thing as i += 1.
In other words, the for loop will use every value of i from 0 up until rapperArray.length - 1. So console.log(rapperArray[i]); will be the same as console.log(rapperArray[0]); in the first iteration, console.log(rapperArray[1]); in the second iteration, and so on.
You can see this more clearly by running the following:
const rapperArray = ['Tupac', 'Jay-Z', 'Notorious B.I.G', 'Kendrick Lamar'];
for (let i = 0; i < rapperArray.length; i++) {
console.log('When i is ' + i + ', rapperArray[i] is ' + rapperArray[i] + '.');
}
rapperArray[0]functions?i, which you established as having a starting value of0is incremented by one (that's what thei++means). Since Arrays start indexing at 0, the first time throughiwill be0and thereforerapperArray[i]will referencerapperArray[0]or the first item in the array (Tupac). The second time through,iwill be1andrapperArray[i]will meanrapperArray[1]orJay-Z. This will continue as long asiis less than the length of the array (which is 1-based) or 4.igenerally denotes the current iterative row identifier in an array.var a =['a','b']witha[0] == 'a', a[1] == 'b'and so forth, withibeing0then1in that example,var i = 0; a[i] == 'a'; i = 1; a[i] == 'b'.