How to get the index of an iteration in a for-of loop in JavaScript

PHOTO EMBED

Fri Nov 12 2021 22:20:53 GMT+0000 (Coordinated Universal Time)

Saved by @juancalle #javascript

for (const [i, v] of [array].entries()) {

}
content_copyCOPY

https://flaviocopes.com/how-to-get-index-in-for-of-loop/