let original = {name: 'Joel', favoriteFood: 'oranges', age: 26};
let happyBirthday = {...original, age: 27};
happyBirthday will be an object that is identical to original but with the age overwritten.
So that would result in an object like this:
{name: 'Joel', favoriteFood: 'oranges', age: 27} // Notice the age
Answer from Pedro Filipe on Stack OverflowMDN Web Docs
developer.mozilla.org โบ en-US โบ docs โบ Web โบ JavaScript โบ Reference โบ Operators โบ Spread_syntax
Spread syntax (...) - JavaScript | MDN
May 22, 2026 - The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected. In an object literal, the spread syntax enumerates the properties of an object and adds the key-value ...
W3Schools
w3schools.com โบ react โบ react_es6_spread.asp
React ES6 Spread Operator
The JavaScript spread operator (...) copies all or part of an existing array or object into another array or object.
javascript - Quick question about ES6 spread operator on objects - Stack Overflow
I just have a brief question about using spread operators on objects, when we are trying to return a copy of the object with a field changed. I've been working through a PluralSight tutorial having... More on stackoverflow.com
What actually IS the spread operator?
Tell us whatโs happening: I have passed the test, but I donโt understand why. What exactly is the spread operator?? This definition is given: ES6 introduces the spread operator, which allows us to expand arrays and other expressions in places where multiple parameters or elements are expected. More on forum.freecodecamp.org
What is JavaScript's spread operator (...), and how is it used?
The spread operator (...) in JavaScript is a syntax that allows an iterable (such as an array or string) or an object to be expanded in places where multiple elements or key-value pairs are expected. More on mindstick.com
Spread operator
Afraid not. Javascript get syntax does not create a property that is enumerable. It can be accessed directly but won't be accessed via an object spread or a for/in loop. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#using_getters_in_classes More on reddit.com
DEV Community
dev.to โบ marinamosti โบ understanding-the-spread-operator-in-javascript-485j
Understanding the Spread Operator in JavaScript - DEV Community
September 23, 2019 - Another great way to use the spread operator is to make a copy of an array or an object. In JavaScript when you assign an object or array to a variable you're actually storing something called the "pointer", which sort of works like the address of where that object is being stored.
GeeksforGeeks
geeksforgeeks.org โบ javascript โบ javascript-spread-operator
JavaScript Spread Operator - GeeksforGeeks
The spread operator (...) in JavaScript provides a simple and expressive way to expand elements from arrays, strings, or objects. It helps make code cleaner by reducing the need for manual copying or looping.
Published ย January 16, 2026
Telerik
telerik.com โบ blogs โบ rest-spread-operators-explained-javascript
Rest and Spread Operators Explained in JavaScript
February 27, 2024 - The rest and spread operators are two of the advanced features introduced in ES6, allowing us to spread out and mix several elements. These two operators havenโt received as much attention in recent development, yet they play a significant role in writing clean and efficient code.
Top answer 1 of 2
7
let original = {name: 'Joel', favoriteFood: 'oranges', age: 26};
let happyBirthday = {...original, age: 27};
happyBirthday will be an object that is identical to original but with the age overwritten.
So that would result in an object like this:
{name: 'Joel', favoriteFood: 'oranges', age: 27} // Notice the age
2 of 2
5
Objects cannot have duplicate keys. If you assign a key to an object when that object already has said key, or write an object initializer with duplicate keys, the prior value at that key will be overwritten:
const obj = {
foo: 'foo',
bar: 'bar',
};
obj.foo = 'new';
console.log(obj);
const obj = {
foo: 'foo',
bar: 'bar',
foo: 'new',
};
console.log(obj);
When using object spread, the same sort of thing is going on. If you add a key-value pair when a prior key already exists in the object initializer (by spread or otherwise), the prior value will be overwritten.
let happyBirthday = {...original, age: 27};
is very similar to
// Create a new object with all properties of `original`:
let happyBirthday = Object.assign({}, original);
// Assign to the `age` property of the new object:
happyBirthday.age = 27;
Mimo
mimo.org โบ glossary โบ javascript โบ spread-operator
JavaScript Spread Operator: Syntax, Usage, and Examples
Use the JavaScript spread operator (...) to expand arrays, objects, and strings, copy and merge data, update state immutably, and pass values into functions, with practical examples and common pitfalls.
Jonlinnell
jonlinnell.co.uk โบ articles โบ spread-operator-performance
How slow is the Spread operator in JavaScript? | Jon Linnell
August 17, 2022 - My semi-educated guess, given the disparity in timings we see, is that the spread operator is iterating one-by-one through each element, assigning each one to a new space in memory in sequence.
W3Schools
w3schools.com โบ jsref โบ jsref_oper_spread.asp
JavaScript Spread Operator
The Spread Operator (...) spreads iterables into individual elements. The ... operator can pass arguments to functions: const numbers = [23,55,21,87,56]; let minValue = Math.min(...numbers); let maxValue = Math.max(...numbers); Try it Yourself ...
MindStick
mindstick.com โบ forum โบ 160760 โบ what-is-javascript-s-spread-operator-and-how-is-it-used
What is JavaScript's spread operator (...), and how is it used? โ MindStick
June 19, 2024 - The spread operator (...) in JavaScript is a syntax that allows an iterable (such as an array or string) or an object to be expanded in places where multiple elements or key-value pairs are expected.
Codecademy
codecademy.com โบ docs โบ javascript โบ spread operator
JavaScript | Spread Operator | Codecademy
January 8, 2025 - The Spread Operator in JavaScript, represented by three dots (...), is used to expand or unpack elements of arrays, objects, or other iterables into individual elements.