map&foreach

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
map
const arr = [1, 2, 3, 4, 5];
const newArr1 = arr.map(item => item * 2);
ready
foreach
const arr = [1, 2, 3, 4, 5];
const newArr2 = [];
arr.forEach(item => newArr2.push(item * 2));
ready

Revisions

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