I totally agree with you regarding for loop and how .map, .reduce, .filter are a heavenly match for functional programming. But there are cases where I feel for of loop is a natural fit:
Iterator: Javascript now has native support for iterators (I talk about them in my article), so dealing with Map, Set, Array etc, the for of loop becomes a natural choice over converting these iterators to arrays and then applying the functional methods.
Async: Another area I find for of loop a rather easier read is when I have to iterate through an async collection. I talk about some examples of async for loop here.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I totally agree with you regarding
for loopand how.map,.reduce,.filterare a heavenly match for functional programming. But there are cases where I feelfor ofloop is a natural fit:Iterator: Javascript now has native support for iterators (I talk about them in my article), so dealing with
Map,Set,Arrayetc, thefor ofloop becomes a natural choice over converting these iterators to arrays and then applying the functional methods.Async: Another area I find
for ofloop a rather easier read is when I have to iterate through an async collection. I talk about some examples of async for loop here.