Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0
Firefox 59
Ubuntu
Other
6 years ago
Test name Executions per second
Using the spread operator 1909219.2 Ops/sec
Using Object.assign 6209119.0 Ops/sec
Tests:
  • Using the spread operator

    AخA
     
    const firstObject = { test: 'Hello world', test1: "blah", test2: "ze" }
    const secondObject = { test1: 'La woopp', test2: 'te' }
    const finalObject = {
        ...firstObject,
        ...secondObject
    };
  • Using Object.assign

     
    const firstObject = { test: 'Hello world', test1: "blah", test2: "ze" }
    const secondObject = { test1: 'La woopp', test2: 'te' }
    const finalObject = Object.assign(firstObject, secondObject);