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