for vs for of

Benchmark created on


Setup

const test = [1, 2, 3, 4, 3, 2, 1];
let sum = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
for
for (let k = 0; k < test.length; k++)
	sum += test[k];
sum = 0;

ready
for of
for (const t of test)
	sum += t;
sum = 0;
ready

Revisions

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