For vs Foreach (v2)

Revision 2 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
For
let x = 0;
for (let i = 0; i < 10; i++) {
	x += i;
}
ready
Foreach
let x = 0;
const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
arr.forEach(i => x += i);
ready
Map
let x = 0;
const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
arr.map(i => x += i);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.