🌐
freeCodeCamp
freecodecamp.org › news › javascript-spread-and-rest-operators
JavaScript Spread and Rest Operators – Explained with Code Examples
February 8, 2024 - Unlike traditional methods like ... array duplication. While the spread operator expands elements, the rest operator condenses them into a single entity within function parameters or array destructuring....
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › what-is-the-rest-parameter-and-spread-operator-in-javascript
Rest Parameter And Spread Operator in JavaScript - GeeksforGeeks
October 27, 2025 - The ...n spread operator expands the n array into individual elements, so [...n, 4, 5] becomes [1, 2, 3, 4, 5]. The code then logs the new array ne, which contains the original elements plus 4 and 5 at the end.
Discussions

spread vs rest syntax in JS, a little confused.
the teacher said that the spread operator is on the right side of the "=" This seems like a really bad way of describing things. The "rest" operator appears inside of parameter lists (like in your example), or inside a destructuring declaration (like let [a, ...b] = [1, 2, 3]). It occurs where variables are being created. The "spread" operator is used when you want to "spread"/flatten the data you have into another structure. That can occur inside argument lists (some_func(...data)), or inside of something like an array ([1, 2, 3, ...someData, 4, 5, 6]). In both cases, the placement of the = is irrelevant. More on reddit.com
🌐 r/learnprogramming
4
1
July 14, 2022
Spread Operator vs Rest Parameter
Console log is a good example of the rest one for anyone struggling to think of it. You've probably written console.log(1, 2, 3, 4) etc in the past, that is to say you can pass any number of arguments into the function and it will be ok with it More on reddit.com
🌐 r/learnjavascript
26
290
September 16, 2022
What is the difference between the rest and spread operator?
I think its very confusing More on reddit.com
🌐 r/learnjavascript
3
7
September 16, 2021
Rest and Spread operator: Three dots that changed JavaScript

I wouldn't recommend naming the function parameter of a reduce previous.

function sum(...args) {
return args.reduce((previous, current)=> {
return previous + current;
});
}

The first parameter is the accumulator. total or previousTotal or anything that suggests that we're building on it may be better.

previous suggests that we're comparing to the previous item in the array, and examples that use it can make reduce functions even more complicated to understand than they need to be.

More on reddit.com
🌐 r/learnjavascript
4
98
August 18, 2020
🌐
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 - In the above example, the spread syntax does not work as one might expect: it spreads an array of arguments into the object literal, due to the rest parameter.
🌐
Codefinity
codefinity.com › blog › Understanding-the-Spread-and-Rest-Operators-in-JavaScript
Understanding the Spread and Rest Operators in JavaScript
This article explains the spread and rest operators in JavaScript, highlighting their distinct uses for working with arrays, objects, and function parameters. It covers how the spread operator unpacks elements and the rest operator gathers elements into a single array or object.
🌐
Educative
educative.io › answers › what-are-the-spread-and-rest-operators-in-javascript
What are the spread and rest operators in javascript?
Line 1: We define a function more_than_three() using the rest operator in the arguments. Line 2: We will print the received arguments. Line 3: We will return the numbers that are greater than 3. Line 6: We will make a function call.
🌐
TutorialsPoint
tutorialspoint.com › rest-and-spread-operators-in-javascript
Rest and Spread operators in JavaScript
July 15, 2020 - <!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> <style> body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample, .result { font-size: 20px; font-weight: 500; } </style> </head> <body> <h1>JavaScript Rest and spread operator</h1> <div class="sample"></div> <div style="color: green;" class="result"></div&g; <button class="btn">Spread Operator</button> <h3> Click on the above button to concatenate array using spread operator </h3> <button class="btn">Rest Opera
🌐
Scaler
scaler.com › home › topics › what is the difference between spread and rest operator in javascript?
Difference Between Spread and Rest Operator in JavaScript | Scaler Topics
July 7, 2024 - Take a look at the below example to see how it works: ... Here, the spread operator (…) takes the values of array a and b and spreads them into a new array c. The spread operator can also be used in function calls. We will look at several use cases of the spread operator later in this article.
🌐
freeCodeCamp
freecodecamp.org › news › javascript-rest-vs-spread-operators
JavaScript Rest vs Spread Operator – What’s the Difference?
September 15, 2021 - In JavaScript functions, rest gets used as a prefix of the function’s last parameter. ... // Define a function with two regular parameters and one rest parameter: function myBio(firstName, lastName, ...otherInfo) { return otherInfo; }
Find elsewhere
🌐
Medium
medium.com › @pallavi8khedle › difference-between-spread-and-rest-operator-dc43a86a8991
Difference between Spread and Rest operator | by Pallavikhedle | Medium
April 22, 2024 - Spread Operator(`…`): The spread operator(…) is used to expand or spread elements from an iterable (such as an array, string, or object) into individual elements. ... Rest operator(`…`): The rest operator(…) is used in function parameters ...
🌐
Exercism
exercism.org › tracks › javascript › concepts › rest-and-spread
Rest and Spread in JavaScript on Exercism
When ... appears in a function definition next to its last argument, that parameter is called a rest parameter. It allows the function to accept an indefinite number of arguments as an array. function concat(...strings) { return strings.join(' '); } concat('one'); // => 'one' concat('one', 'two', 'three'); // => 'one two three' When ... appears on the right-hand side of an assignment, it's known as the spread operator.
🌐
Telerik
telerik.com › blogs › rest-spread-operators-explained-javascript
Rest and Spread Operators Explained in JavaScript
February 27, 2024 - Let’s take the time to understand these helpful JavaScript operators. 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. For example, they offer a compelling alternative to the concat method, which was introduced back in ES3.
🌐
DEV Community
dev.to › _sumayah › javascript-spread-and-rest-operators-explained-with-code-examples-57gb
JavaScript Spread and Rest Operators – Explained with Code Examples - DEV Community
January 22, 2025 - Unlike traditional methods like ... The Rest Operator While the spread operator expands elements, the rest operator condenses them into a single entity within function parameters or array destructuring....
🌐
Medium
medium.com › @anton.martyniuk › spread-and-rest-operators-in-javascript-a5d1f1ee60dd
Spread and Rest Operators in JavaScript | by Anton Martyniuk | Medium
March 21, 2024 - While the spread operator expands an array or object into its individual elements, the rest operator does the opposite, collecting multiple elements or properties into a single array or object.
🌐
Medium
medium.com › @shubham3480 › rest-and-spread-operator-in-javascript-3950e16079c8
Rest and Spread Operator in JavaScript | by Shubham Gupta | Medium
February 16, 2025 - Rest and Spread Operator in JavaScript Rest and Spread operators use (…) three dots but are not the same. Rest Operator The operator is used to put some user-supplied values into an Array. The text …
🌐
DEV Community
dev.to › baroblesvi › spread-vs-rest-operators-in-javascript-45f3
Spread vs Rest Operators in JavaScript - DEV Community
March 12, 2024 - Now, take this tip so you don't confuse rest with spread here: the rest is on the left side of = and the spread is on the right side of =. ... Thanks for making it this far! I hope this post has helped you! Thoughts? Please, comment below! ... I speak JavaScript.
🌐
Iqra Technology
iqratechnology.com › academy › javascript-training › js-rest-and-spread
Free JavaScript Rest and Spread Tutorial for Beginners - JS Basics
January 15, 2025 - Find this explained in the JavaScript rest and spread with free tutorial. 5. How do I copy an array using the spread operator? Use the spread operator to create a shallow copy of an array. Example:
🌐
DEV Community
dev.to › wisdomudo › javascript-spread-and-rest-operators-explained-a-beginners-guide-to-es6-2bfa
JavaScript Spread and Rest Operators Explained: A Beginner’s Guide to ES6+ - DEV Community
October 2, 2025 - Rest (...) collects several values and puts them into one array. Spread is useful for copying and merging data. Rest is useful for handling multiple function arguments. Both operators improve the readability and structure of your JavaScript code.
🌐
Medium
medium.com › @luke_smaki › javascript-es6-spread-operator-and-rest-parameters-b3e89d112281
JavaScript ES6: Spread Operator and Rest Parameters | by Luke Ruokaismaki | Medium
August 15, 2018 - Using the rest parameter in the ... to read. The spread operator allows us to spread the value of an array (or any iterable) across zero or more arguments in a function or elements in an array (or any iterable)....
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › spread-vs-rest-operator-in-javascript-es6
Spread vs Rest operator in JavaScript ES6 - GeeksforGeeks
February 23, 2024 - Example: The rest operator gathers all arguments passed to the function after the first one (10 in this case) into an array called rest. ... The spread operator, represented by three dots (...), works by taking all the items in an array and ...