re: Array.map() much slower than for loop VIEW POST

TOP OF THREAD FULL DISCUSSION
re: As you say, and i want to add something, the map tool returns you an array with the result of every element through the callback, if you don't want...
 

But isn't that essentially what the for loop is also doing?

Correct. However, you should avoid using the for loop in general, because it will iterate over every property of the item passed to it including things which you might not want to iterate over (like a for in loop would do).

Alternatives to for include: forEach, for of, map etc

code of conduct - report abuse