Given a for of loop the value of the assigned the variable(i
for this example) is equal to what array[i]
would equal if it was a normal for loop. H
You mean this?
array = ["one", "two", "three"];
for (i = 0; i < array.length; i++) {
console.log(i); // Logs the current index number;
console.log(array[i]); // Logs the index matching in the array;
}
Also a good comment from Kaiido was that you can use this to get the value from the array directly as a variable.
for (var ind = 0, i=array[ind]; ind < array.length; i=array[++ind]) {
console.log(i);
console.log(ind);
}