If i have an array:
[1, 2, 3, 4, 5] -
I can loop with:
for (let [i, x] of arr.entries()){..}
If i have a generator function:
function* g() {
yield 1; yield 2; yield 3;
}
I cannot.
So the questions is how to get index and key of loops with for of and generator.
Is there the same syntax for both regular array and generator.
And lastly why generators hasnt method "entries" since they are both iterable.
Whats the point of iterable if they are accessed in different ways.