Test

Benchmark created on


Setup

let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30];

Test runner

Ready to run.

Testing in
TestOps/sec
foreach
arr.forEach((num, index) => {
    return arr[index] = num * 2;
});
ready
map
let doubled = arr.map(num => {
    return num * 2;
});
ready

Revisions

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