Test name | Executions per second |
---|---|
Using the spread operator | 2381782.8 Ops/sec |
Using Object.assign | 3596641.8 Ops/sec |
Using Native assignment. | 352089024.0 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(firstObject, secondObject);
const firstObject = { sampleData: 'Hello world' };
const secondObject = { moreData: 'foo bar' };
firstObject.moreData = 'foo bar';