Manipulate a specific value in all objects in an array (v2)

Revision 2 of this benchmark created on


Setup

let arr = [{ foo: 1 }, { foo: 2 }, { foo: 3 }, { foo: 4 }]

Test runner

Ready to run.

Testing in
TestOps/sec
forEach()
arr.forEach((item, index) => { arr[index] = item.foo++ })
ready
map()
arr = arr.map(item => item.foo++)
ready

Revisions

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