Test name | Executions per second |
---|---|
Using the spread operator | 2002556.4 Ops/sec |
Using Object.assign | 5070800.0 Ops/sec |
const firstObject = { sampleData: 'Hello world' }
const secondObject = { moreData: 'foo bar' }
const finalObject = {
firstObject,
secondObject
};
const firstObject = {}
const secondObject = { sampleData: 'Hello world', moreData: 'foo bar' }
const finalObject = Object.assign(firstObject, secondObject);