What does the spread operator (...) do when used in function calls?
Answer
Expands an array into individual arguments
Answer
Expands an array into individual arguments
The spread operator (...) expands an array into individual arguments when used in a function call. For example, fn(...values) passes each element of values separately, as though the call had been written with the elements listed one by one.
Spread syntax was introduced with ECMAScript 2015, commonly called ES6. In a call, it works with iterable values, including arrays, strings, and other iterable objects. It is different from passing the array itself: fn(values) sends one array argument, while fn(...values) sends its elements as separate arguments.
A common mix-up is confusing spread syntax with a rest parameter. The same three dots collect remaining arguments when they appear in a function definition, such as function fn(...args). Spread expands; rest gathers. Object-property copying and array concatenation are also valid uses of related syntax, but they describe other contexts, not function calls.
Source: Wikipedia · fact-checked Aug. 2026