Object Assignment

Benchmark published by System on

Description

Object.assign vs Spread operator.

Setup

const obj1 = { a: 1, b: 2 };
const obj2 = { c: 3, d: 4 };

Test Runner

Initializing...

Testing in
Test CaseOps/sec
Object.assign
const merged = Object.assign({}, obj1, obj2);
ready
Spread operator
const merged = { ...obj1, ...obj2 };
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

Revision 1
publishedby Systemon