Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JS forEach vs for ... of
compare between forEach and for ... of
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36 EdgA/146.0.0.0
Browser:
Chrome Mobile 146
Operating system:
Android
Device Platform:
Mobile
Date tested:
28 days ago
Test name
Executions per second
forEach
4559802.5 Ops/sec
for ... of
4445821.0 Ops/sec
Script Preparation code:
x = [1,2,3,4,5]
Tests:
forEach
y = [] x.forEach(i => y.push(i))
for ... of
y = [] for (const i of x) { y.push(i) }