This isn't necessarily exhaustive.

Spread syntax

options = {...optionsDefault, ...options};

Advantages:

  • If authoring code for execution in environments without native support, you may be able to just compile this syntax (as opposed to using a polyfill). (With Babel, for example.)

  • Less verbose.

Disadvantages:

  • When this answer was originally written, this was a proposal, not standardized. When using proposals consider what you'd do if you write code with it now and it doesn't get standardized or changes as it moves toward standardization. This has since been standardized in ES2018.

  • Literal, not dynamic.


Object.assign()

options = Object.assign({}, optionsDefault, options);

Advantages:

  • Standardized.

  • Dynamic. Example:

    var sources = [{a: "A"}, {b: "B"}, {c: "C"}];
    options = Object.assign.apply(Object, [{}].concat(sources));
    // or
    options = Object.assign({}, ...sources);
    

Disadvantages:

  • More verbose.
  • If authoring code for execution in environments without native support you need to polyfill.

This is the commit that made me wonder.

That's not directly related to what you're asking. That code wasn't using Object.assign(), it was using user code (object-assign) that does the same thing. They appear to be compiling that code with Babel (and bundling it with Webpack), which is what I was talking about: the syntax you can just compile. They apparently preferred that to having to include object-assign as a dependency that would go into their build.

Answer from JMM on Stack Overflow
Top answer
1 of 15
432

This isn't necessarily exhaustive.

Spread syntax

options = {...optionsDefault, ...options};

Advantages:

  • If authoring code for execution in environments without native support, you may be able to just compile this syntax (as opposed to using a polyfill). (With Babel, for example.)

  • Less verbose.

Disadvantages:

  • When this answer was originally written, this was a proposal, not standardized. When using proposals consider what you'd do if you write code with it now and it doesn't get standardized or changes as it moves toward standardization. This has since been standardized in ES2018.

  • Literal, not dynamic.


Object.assign()

options = Object.assign({}, optionsDefault, options);

Advantages:

  • Standardized.

  • Dynamic. Example:

    var sources = [{a: "A"}, {b: "B"}, {c: "C"}];
    options = Object.assign.apply(Object, [{}].concat(sources));
    // or
    options = Object.assign({}, ...sources);
    

Disadvantages:

  • More verbose.
  • If authoring code for execution in environments without native support you need to polyfill.

This is the commit that made me wonder.

That's not directly related to what you're asking. That code wasn't using Object.assign(), it was using user code (object-assign) that does the same thing. They appear to be compiling that code with Babel (and bundling it with Webpack), which is what I was talking about: the syntax you can just compile. They apparently preferred that to having to include object-assign as a dependency that would go into their build.

2 of 15
353

For reference object rest/spread is finalised in ECMAScript 2018 as a stage 4. The proposal can be found here.

For the most part object assign and spread work the same way, the key difference is that spread defines properties, whilst Object.assign() sets them. This means Object.assign() triggers setters.

It's worth remembering that other than this, object rest/spread 1:1 maps to Object.assign() and acts differently to array (iterable) spread. For example, when spreading an array null values are spread. However using object spread null values are silently spread to nothing.

Array (Iterable) Spread Example

const x = [1, 2, null , 3];
const y = [...x, 4, 5];
const z = null;

console.log(y); // [1, 2, null, 3, 4, 5];
console.log([...z]); // TypeError

Object Spread Example

const x = null;
const y = {a: 1, b: 2};
const z = {...x, ...y};

console.log(z); //{a: 1, b: 2}

This is consistent with how Object.assign() would work, both silently exclude the null value with no error.

const x = null;
const y = {a: 1, b: 2};
const z = Object.assign({}, x, y);

console.log(z); //{a: 1, b: 2}
🌐
Reddit
reddit.com › r/node › [discussion] object spread much faster than object.assign(...) ?!
r/node on Reddit: [Discussion] Object spread much faster than Object.assign(...) ?!
December 26, 2021 - With a blank `obj` object assign is about as fast as object rest spread.... once any keys are added into the object, it's an order of magnitude slower.
Discussions

Spread Operator(Object inside Object)
I’m trying to use the spread operator to change only the city property of the address Object If I try const user2 = {...user, address: { city: "Quebec"}}; I’m gonna lose the other properties of address Object. Any hint to solve problems with Objects inside Objects · Wouldn’t that modify ... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
8
0
October 8, 2019
Object.assign vs Object Spread in Node.js

I've actually been wondering lately how these two measure up. Very interesting.

I ran his same tests in Node and got similar results.

HOWEVER I ran the tests in Chrome and got very different results:

First set (Object.assign directly)

Object spread x 3,032,358 ops/sec ±0.78% (54 runs sampled)
Object.assign() x 21,901,498 ops/sec ±5.47% (56 runs sampled)
Fastest is Object.assign()

Second set (Object.assign to new {})

Object spread x 2,991,669 ops/sec ±0.93% (53 runs sampled)
Object.assign() x 16,659,708 ops/sec ±1.50% (57 runs sampled)
Fastest is Object.assign()

Object.assign is still way faster than spread in Chrome. Still not a huge deal unless you're trying to optimize, but worth considering.

More on reddit.com
🌐 r/Frontend
2
40
February 5, 2019
When would you use this function instead of Object.assign or the spread operator?

You wouldn't (unless you really needed to support IE and couldn't transpile with something like Babel). That site is just a little dated so you're not going to see any newer ES6+ syntax. From their homepage:

All functions work properly in IE 9 and above - most of them are compatible with IE 8. Common pitfalls are mentioned alongside concerned functions. Available plugins have no dependencies and are tested in IE 9+, some work properly in IE 8 and below.

More on reddit.com
🌐 r/learnjavascript
1
6
March 29, 2020
Conditionally spreading objects in JavaScript
I wouldn’t do that because future engineers may not get it. I’d in-line a ternary …(isActive ? user : {}) More on reddit.com
🌐 r/javascript
44
152
September 19, 2022
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › difference-between-objectassign-and-spread-operator-in-javascript
Difference Between Object.assign and Spread Operator in JavaScript - GeeksforGeeks
July 23, 2025 - While Object.assign() is useful for the merging properties into the existing object, the spread operator is more suited for creating new objects with the merged properties.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Spread_syntax
Spread syntax (...) - JavaScript | MDN
May 22, 2026 - In addition, Object.assign() triggers setters on the target object, whereas spread syntax does not.
🌐
Medium
medium.com › @corinnemariekelly › object-assign-vs-spread-operator-577c889dbadc
object.assign() vs spread operator | by Corinne Kelly | Medium
April 30, 2017 - Javascript is not the only language I am continuously learning but that is exactly how I would describe the Object.assign() function if I’m trying to make a copy of an object. Ironically, the official javascript MDN docs use the “spread operator syntax” (aka the three dots) to describe what Object.assign does.
🌐
DEV Community
dev.to › patrickjsmirnov › comment › d9e1
What is difference between spread and object.assign? - DEV Community
July 22, 2019 - We aren't actually using the returned value of the function at all, but we are modifying our target object which we have referenced with the const food. Spread on the other hand is an operator which copies properties of one object into a new object.
Find elsewhere
🌐
Datadog
docs.datadoghq.com › code_analysis › static_analysis_rules › javascript-best-practices › prefer-object-spread
Prefer using an object spread over `Object.assign`
This rule encourages the use of the object spread syntax over the Object.assign method when creating a new object from an existing one where the first argument is an empty object.
🌐
The App Founders
theappfounders.com › blog › object-assign-vs-object-spread-operator
Object.assign() vs. Object spread operator
March 14, 2024 - Think of objects like boxes that hold different things. These “things” can be numbers, words, or even actions in JavaScript. Now, two main ways to handle these boxes and rearrange or combine their contents are Object.assign() and another method that involves spreading objects out, the object spread operator.
🌐
Azurewebsites
benchmarklab.azurewebsites.net › Benchmarks › Show › 8719 › 0 › javascript-spread-operator-vs-objectassign-vs-new-objec
Benchmark: JavaScript spread operator vs Object.assign vs new object performance - MeasureThat.net
object assign vs object spread on growing objects · JavaScript spread operator vs Object.assign performance (single addition) JavaScript spread operator vs Object.assign performance - Kien Nguyen · Object.assign() vs spread operator (New object) JavaScript spread operator vs Object.assign performance test number 99 ·
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Object › assign
Object.assign() - JavaScript | MDN
The Object.assign() static method copies all enumerable own properties from one or more source objects to a target object. It returns the modified target object.
🌐
Delicious-insights
delicious-insights.com › en › posts › js-object-spread-assign
Object spread vs. Object.assign • Delicious Insights
May 18, 2020 - Just remember that an object spread always returns a new object, of type Object, and will therefore blissfully ignore the type and writer accessors of the original object(s). Incidentally, this means that when you must alter the original object, ...
🌐
DEV Community
dev.to › codefinity › object-assign-and-spread-kcl
Object Assign and Spread - DEV Community
October 31, 2020 - This time, we avoid mutating any of the object literals; Instead, we 'assemble' all of the 🔑s from each of the 'existing objects' into a 'new' object literal. This time we achieve the same results, but with the cleaner spread syntax: ....
🌐
Medium
adambrodziak.medium.com › use-js-object-spread-operator-instead-of-object-assign-pattern-in-node-8-125a4914f6dd
Use JS object spread operator instead of Object.assign() pattern in Node 8 | by Adam Brodziak | Medium
December 21, 2017 - One of the best features of Node 8.6+ is the ability to use rest/spread operator for objects. It’s still an ESNEXT stage 3, but it’s so useful already. Take a look at the snippet: const foo = { a:1, b:2, c: 3} const bar = { d:4, b:9 }const foobar1 = Object.assign({}, foo, bar) const foobar2 = { ...foo, ...bar }console.log(foobar1, foobar2) console.log(JSON.stringify(foobar1) === JSON.stringify(foobar2))
🌐
Azurewebsites
benchmarklab.azurewebsites.net › Benchmarks › Show › 19868 › 0 › structuredclone-vs-spread-vs-objectassign
Benchmark: structuredClone vs spread vs Object.assign() - MeasureThat.net
Spread vs Object.assign (modify ) vs Object.assign (new) JavaScript spread operator vs Object.assign vs new object performance · object spread vs Object.assign · JavaScript spread operator vs Object.assign performance fixed 2 · JavaScript spread operator vs Object.assign performance test number 99 ·
🌐
Medium
medium.com › @yazeedb › how-do-object-assign-and-spread-actually-work-169b53275cb
How Do Object.assign and Spread Actually Work? | by Yazeed Bzadough | Medium
December 31, 2017 - The code in my last article made good use of spread because of its powerful expressivity. Let’s break it down to better appreciate its magic. It lets you expand any iterable (like an array or string) in an array or function parameters, or expand any object into another object.
🌐
The Code Barbarian
thecodebarbarian.com › object-assign-vs-object-spread.html
Object.assign vs Object Spread in Node.js
January 29, 2019 - In other words, Object.assign() modifies an object in place, and so it can trigger ES6 setters. If you prefer using immutable techniques, the object spread operator is a clear winner.
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript tutorial › javascript object spread
JavaScript Object Spread Operator (...)
November 4, 2024 - The spread operator (...) defines new properties in the target object while the Object.assign() method assigns them.
🌐
freeCodeCamp
forum.freecodecamp.org › curriculum help
Spread Operator(Object inside Object) - Curriculum Help - The freeCodeCamp Forum
October 8, 2019 - const user= { name: "Diego", age: 23, address: { city: "Toronto", country: "Canada", phone: "9119119111" } }; I’m trying to use the spread operator to change only the city property of the address Object If I try const user2 = {...user, address: { city: "Quebec"}}; I’m gonna lose the other properties of address Object.