3

How do I get the current iteration count of my for...of loop?

let iterable = new Set([1, 1, 2, 2, 3, 3]);

let i = 0;
for (let value of iterable) {
  console.log('value in Iteration count = ' + i + ' is :' + value);
  i++;
}

This is what I currently have, is there some kind of built in iteration count variable which can replace my variable i?

0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.