Test name | Executions per second |
---|---|
Using the spread operator | 1064076.9 Ops/sec |
Using Object.assign | 8564312.0 Ops/sec |
let firstObject = { sampleData: 'Hello world' }
const secondObject = { moreData: 'foo bar', a: 1, b: 2, c: false, d: 'hello' }
firstObject = {
firstObject,
secondObject
};
const firstObject = { sampleData: 'Hello world' }
const secondObject = { moreData: 'foo bar', a: 1, b: 2, c: false, d: 'hello' }
Object.assign(firstObject, secondObject);