Skip few index in a for…of loop in Javascript
Posted: 26 Nov 2020, 12:41
With the good old for loop in Javascript I can do things like:
So for every count, I can skip the index by doing a +2.
How can I do the same in the for…of loop to skip the index?
Code: Select all
for (let i=0; i<bla.length; i+=2){
//...
}
How can I do the same in the for…of loop to skip the index?
Code: Select all
for (const [i, element] of bla.entries()) {
//skip few index...
}