javascript - Get iteration count of for...of loop -


how current iteration count of for...of loop?

let iterable = new set([1, 1, 2, 2, 3, 3]);  let = 0; (let value of iterable) {   console.log('value in iteration count = ' + + ' :' + value);   i++; } 

this have, there kind of built in iteration count variable can replace variable i?

you can use indexof if don't want make temp variable, solution more efficient. can iterate on keys of collection, rather values.


Comments

Popular posts from this blog

android - How to read a column value in parse.com without accessing an object or a pointer -

ios - NSDateFormatter: error in converting date -

timer - Java TimerTask cancel -