map vs forEach

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
map
function socialNetworksToList(formValues) {
  return Object.keys(socialNetworkInitialValues).map((item) => ({
    name: item,
    username: formValues[item]
  }))
}
ready
forEach
function socialNetworksToList(formValues) {
  return Object.keys(socialNetworkInitialValues).forEach((item) => ({
    name: item,
    username: formValues[item]
  }))
}
ready

Revisions

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