Ditch JS For loops
advancedweb.hu
advancedweb.hu
I put them here: https://jsperf.com/advancedweb-test/1
The for loop executes 20.64x faster in V8.
Again, I think that iterator functions are great and should definitely be used, but it's important to know the cost.
Knowing when to use one or the other is the important bit. Blindly ignoring one of the tools in your toolbox may not be the wisest choice.
In one project my guideline simply became `for (of)` is welcome, `for (;;)` is not. If you are too busy worried about index numbers as `for (;;)` is, you may be missing the big picture (and doing a lot of "useless" math), `for (of)` at least is relatively high level, and with Iterable support `for (of)` gives you more room to more easily move things out of the loop and into higher-order iterable functions before the loop.
Also with async/await, `for (of)` can sometimes be a lot easier to reckon with than higher order functions. People don't easily grasp Promise combinators, but `for (of) { const thing = await process() }` is readable for most everyone.
From what I understand the point of a for over a while is that you will iterate for a certain known number of times. But if you aren't doing that (break) isn't the while a better option so you can encapsulate the break in the condition as opposed to random locations in the block.
Using map/reduce/filter means iterating over each subsequent list, making what could be an O(n) algorithm a lot slower.
I understand the quest for clarity, but one has to consider each case.