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