3 ms·
Huh, do you have a source on that statement? I'm not disagreeing with you, I actually don't know, and am always happy to learn useful facts for refactoring and
by dvdhnt 9y ago
Huh, do you have a source on that statement?
I'm not disagreeing with you, I actually don't know, and am always happy to learn useful facts for refactoring and improved performance :)
- satori99 9y agoThere 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!