🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Spread_syntax
Spread syntax (...) - JavaScript - MDN Web Docs - Mozilla
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 ...
🌐
Medium
eleftheriabatsou.medium.com › javascript-spread-operator-explained-with-examples-a38caf568ffd
JavaScript Spread Operator Explained (with Examples) | by Eleftheria Batsou | Medium
September 30, 2024 - // Spread in function call const numbers = [1, 2, 3]; console.log(Math.max(...numbers)); // Output: 3 // Rest in function definition function multiply(multiplier, ...numbers) { return numbers.map(num => num * multiplier); } console.log(multiply(2, ...
🌐
W3Schools
w3schools.com › howto › howto_js_spread_operator.asp
How To Use the Spread Operator (...) in JavaScript
The JavaScript spread operator (...) expands an iterable (like an array) into more elements.
🌐
freeCodeCamp
freecodecamp.org › news › javascript-spread-and-rest-operators
JavaScript Spread and Rest Operators – Explained with Code Examples
February 8, 2024 - The spread operator, denoted by three consecutive dots (...), is primarily used for expanding iterables like arrays into individual elements. This operator allows us to efficiently merge, copy, or pass array elements to functions without explicitly ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript-spread-operator
JavaScript Spread Operator | GeeksforGeeks
Addition (+) OperatorThe addition operator takes two numerical operands and gives their numerical sum. It also concatenates two strings or numbers.JavaScript// Number + Number => ... JavaScript introduced the Rest Parameter and Spread Operator in ES6 to make handling functions and arrays more flexible and concise.
Published   November 11, 2024
🌐
Mimo
mimo.org › glossary › javascript › spread-operator
JavaScript Spread Operator: Syntax, Usage, and Examples
The spread operator (...) expands arrays, objects, and strings into individual values. Use it to copy data, merge arrays and objects, update state cleanly, and pass array values into functions without extra steps. ... Become a full-stack developer. Learn HTML, CSS, JavaScript, and React as well as NodeJS, Express, and SQL
🌐
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.
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript array methods › javascript spread operator
The Practical Usages of JavaScript Spread Operator
May 8, 2024 - The spread operator (...) unpacks the elements of the odd array. Note that ES6 also has the three dots ( ...) which is a rest parameter that collects all remaining arguments of a function into an array. function f(a, b, ...args) { console.log(args); ...
🌐
W3Schools
w3schools.com › jsref › jsref_oper_spread.asp
JavaScript Spread Operator
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 » · The ... operator can copy arrays: const arr1 = [1, 2, 3]; const ...
Find elsewhere
🌐
Programiz
programiz.com › javascript › spread-operator
JavaScript Spread Operator
The JavaScript spread operator ... is used to expand or spread out elements of an iterable, such as an array, string, or object. This makes it incredibly useful for tasks like combining arrays, passing elements to functions as separate arguments, or even copying arrays. Here's a quick example of the spread statement.
🌐
CodeShack
codeshack.io › home › references › javascript › ...
JavaScript Spread (...) Operator: Syntax & Examples
June 23, 2026 - JavaScript spread (...) expands arrays and objects into individual elements — for copying, merging and passing arguments. Learn spread vs rest, with live examples.
🌐
Kinsta®
kinsta.com › home › resource center › blog › javascript tutorials › unleashing the power of javascript spread operator
Unleashing the Power of JavaScript Spread Operator - Kinsta®
October 1, 2025 - The spread operator in JavaScript is a syntax introduced in ECMAScript 6 (ES6) that allows you to spread the elements of an iterable (such as arrays, strings, or objects), into another iterable or function call.
🌐
DigitalOcean
digitalocean.com › community › tutorials › js-spread-operator
What's the Spread Operator Used For in JavaScript? | DigitalOcean
July 11, 2022 - The spread operator essentially ‘scooped’ out the insides of the foo array and spread the values across the new array in bar. It’s important to note the brackets around the spread operator, [...foo]. The spread operator spreads these values within a new object of the same type; in this case, an array literal.
🌐
DEV Community
dev.to › hkp22 › javascript-spread-operator-advanced-techniques-and-best-practices-5cbn
JavaScript Spread Operator: Advanced Techniques and Best Practices - DEV Community
June 5, 2024 - // Example with arrays const numbers = [1, 2, 3]; const moreNumbers = [...numbers, 4, 5, 6]; console.log(moreNumbers); // Output: [1, 2, 3, 4, 5, 6] // Example with objects const person = { name: 'Alice', age: 25 }; const updatedPerson = { ...person, age: 26, city: 'New York' }; ...
🌐
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.
🌐
Simplyjavascript
simplyjavascript.com › tutorials › spread-operator
JavaScript Spread Operator
The spread operator (...) expands an iterable, such as an array or string, into individual values.
🌐
Max JavaScript
maxjavascript.com › home › javascript spread operator tutorial with examples
JavaScript Spread Operator Tutorial with Examples
October 14, 2024 - In this example, the properties from userSettings override those in defaultSettings. The spread operator (…) in JavaScript is a powerful and flexible tool that simplifies working with arrays, objects, and function arguments.
🌐
RGB Studios
rgbstudios.org › blog › js-spread-operator
Understanding the JavaScript Spread Operator | RGB Studios
May 1, 2024 - Explanation: In this example, originalArray contains [1, 2, 3]. By using the spread operator (...), we create a new array copiedArray that contains the same elements as originalArray.
🌐
Stack Abuse
stackabuse.com › spread-operator-in-javascript
Spread Operator in JavaScript
August 24, 2023 - Both the Spread Operator and Rest Parameter share the same syntax i.e. the three magical dots .... But they behave exactly opposite to each other. As a beginner, sometimes this may be confusing. The bottom-line to understand the behavior is to understand the context in which it is being used. As we learned, the spread operator expands the contents of an iterable.
Top answer
1 of 7
30
  1. In your example given, there is essentially no difference between the two
  2. .concat is significantly more efficient: http://jsperf.com/spread-into-array-vs-concat because ... (spread) is merely syntax sugar on top of more fundamental underlying syntax that explicitly iterates over indexes to expand the array.
  3. Spread allows sugared syntax on top of more clunky direct array manipulation

To expand on #3 above, your use of spread is a somewhat contrived example (albeit one that will likely appear in the wild frequently). Spread is useful when - for example - the entirety of an arguments list should be passed to .call in the function body.

function myFunc(){
    otherFunc.call( myObj, ...args );
}

versus

function myFunc(){
    otherFunc.call( myObj, args[0], args[1], args[2], args[3], args[4] );
}

This is another arbitrary example, but it's a little clearer why the spread operator will be nice to use in some otherwise verbose and clunky situations.

As @loganfsmyth points out:

Spread also works on arbitrary iterable objects which means it not only works on Arrays but also Map and Set among others.

This is a great point, and adds to the idea that - while not impossible to achieve in ES5 - the functionality introduced in the spread operator is one of the more useful items in the new syntax.


For the actual underlying syntax for the spread operator in this particular context (since ... can also be a "rest" parameter), see the specification. "more fundamental underlying syntax that explicitly iterates over indexes to expand the array" as I wrote above is enough to get the point across, but the actual definition uses GetValue and GetIterator for the variable that follows.

2 of 7
8

Taking the questions out of order, let's start with the fundamental question: What exactly is the use of spread syntax?

Spread syntax basically unpacks the elements of an iterable such as an array or object. Or, for the more detailed explanation from the MDN Web Docs on spread syntax:

Spread syntax allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals) are expected.

Following are some simple examples of typical use cases for spread syntax and an example of the difference between spread syntax and rest parameters (they may look the same, but they perform nearly opposite functions).

Function call:

const multiArgs = (one, two) => {
  console.log(one, two);
};

const args = [1, 2];
multiArgs(...args);
// 1 2
Run code snippetEdit code snippet Hide Results Copy to answer Expand

Array or string literal:

const arr1 = [2, 3];
const arr2 = [1, ...arr1, 4];
console.log(arr2);
// [1, 2, 3, 4]

const s = 'split';
console.log(...s);
// s p l i t
Run code snippetEdit code snippet Hide Results Copy to answer Expand

Object literal:

const obj1 = { 1: 'one' };
const obj2 = { 2: 'two' };
const obj3 = { ...obj1, ...obj2 };
console.log(obj3);
// { 1: 'one', 2: 'two' }
Run code snippetEdit code snippet Hide Results Copy to answer Expand

Rest parameter syntax is not the same as spread syntax:

Rest parameter syntax looks the same as spread syntax but actually represents an unknown number of function arguments as an array. So rather than "unpacking" the iterable, rest parameters actually package multiple arguments into an array.

const multiArgs = (...args) => {
  console.log(args);
};

multiArgs('a', 'b', 'c');
// ['a', 'b', 'c']
Run code snippetEdit code snippet Hide Results Copy to answer Expand

Spread syntax performance / efficiency:

To address the question about efficiency compared to other methods, the only honest answer is that "it depends". Browsers change all the time and the context and data associated with a particular function create wildly different performance outcomes, so you can find all sorts of conflicting performance timings that suggest spread syntax is both amazingly faster and ridiculously slower than various array or object methods you might use to accomplish similar objectives. In the end, any situation where optimizations for speed are critical should be comparison tested rather than relying on generic timings of simplistic functions that ignore the specifics of your code and data.

Comparison to concat():

And finally a quick comment regarding the difference between spread syntax and concat() shown in the question code. The difference is that spread syntax can be used for a lot more than just concatenating arrays, but concat() works in older browsers like IE. In a situation where you are not concerned about compatibility with older browsers and micro optimizations for speed are unnecessary, then the choice between spread syntax and concat() is just a matter of what you find more readable: arr3 = arr1.concat(arr2) or arr3 = [...arr1, ...arr2].