5 ms·
It depends on what you're doing within the loop. With a for loop, you still have to perform an array lookup. For something simple, like summing up all the numbe
by warfangle 15y ago
It depends on what you're doing within the loop. With a for loop, you still have to perform an array lookup. For something simple, like summing up all the numbers in an array, forEach is definitely faster. Try JSLitmus'ing it.