for of loop with index and entries

PHOTO EMBED

Fri Jun 21 2024 22:34:10 GMT+0000 (Coordinated Universal Time)

Saved by @davidmchale #for #loop #index

 for (const item of menu.entries()) {
    const [index, ...menuItem] = item;
    const startIndex = index + 1;
    console.log(`${startIndex}: ${menuItem}`);
  }
content_copyCOPY