for of loop with index array

PHOTO EMBED

Sun Jun 16 2024 01:21:28 GMT+0000 (Coordinated Universal Time)

Saved by @davidmchale #loop #index #array

 const players = [...document.querySelectorAll('section.player')];

    for (const [index, item] of players.entries()) {
      console.log(i, v);
    }




// 0 <section class=​"player player--0 player--active">​…​</section>
// 1 <section class=​"player player--1">​…​</section>
content_copyCOPY