loops test

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
foreach
function forEach() {
  const arr = [];

  for(let i = 0; i < 100000; i++)
    arr[i] = Math.random() * 42;

  arr.forEach((el) => {
    console.log(el);
  });
}

forEach()
ready
for loop
function forLoop() {
  const arr = [];

  for(let i = 0; i < 100000; i++)
    arr[i] = Math.random() * 42;

  for(let i = 0; i < arr.length; i++) 
    console.log(arr[i]);
}

forLoop()
ready

Revisions

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