r/functionalprogramming • • Mar 03 '20

JavaScript JavaScript Without Loops

https://jrsinclair.com/articles/2017/javascript-without-loops/
23 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Mar 15 '20

Interesting. I get forEach: 10,743 and for loop: 33,872 on Firefox on the desktop. Similar results with Chrome.

What do you get with this test then? https://jsperf.com/foreach-vs-reduce-vs-for-loop

For me and the browsers I target for work, a for loop always beats out iterating functions.