3 ms·
There are plenty of online benchmarks that show this. jsperf is down for me atm, so i can't provide a link. Some of the popular JS frameworks actually re-imple
by satori99 9y ago
There are plenty of online benchmarks that show this. jsperf is down for me atm, so i can't provide a link.
Some of the popular JS frameworks actually re-implement an array.forEach function as an internal for-loop to mitigate this.
I am not sure of why this is the case, and I am also not sure if the situation has improved or not since I last had to deal with the performance difference.
edit: The mozilla page about this has a polyfill for the forEach method, that shows it does more than a simple for loop:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Polyfill https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- dvdhnt 9y agoCool, thanks!