Hacker News new | ask | show | jobs
by bobthepanda 673 days ago
you don't even need range loops.

you have forEach:

   list.forEach((item, index) => doSomething());
you also have for/of, though that doesn't have an index if you need that

   for (const item of list) { doSomething() };
which just obviates the need for index incrementing in the most common case, where you are incrementing by one until you hit the end of the list.