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 (iPhone; CPU iPhone OS 27_0_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/150.0.7871.113 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 150
Operating system:
iOS 27.0.0
Device Platform:
Mobile
Date tested:
21 days ago
forEach
68.4M/s
for ... of
17.9M/s
View exact numbers
Test name
Executions per second
✓
forEach
68,369,448 Ops/sec
for ... of
17,916,430 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) }