3 ms·
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 i
by bobthepanda 2y 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.