Favorites

JavaScript ... Spread syntax Operator

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
...
JavaScript Other OperatorThis operator is supported by all modern browsers.
Updated 28th November 2026

Spread syntax (...) expands an array, string or object into individual elements or properties. The same syntax collects remaining items as rest parameters.

Description

Spread syntax ... expands an iterable, such as an array, string, Set or Map, into individual elements, or an object into its properties. In array literals it copies or merges arrays ([...a, ...b]); in function calls it passes array elements as separate arguments (Math.max(...nums)); in object literals it copies properties ({ ...defaults, ...options }), later ones overriding earlier ones.

The same three dots do the opposite job as rest syntax: in function parameters and destructuring patterns, they collect the remaining items into an array or object. All copies made with spread are shallow.

Spreading an object copies its own enumerable properties, including symbol-keyed ones, but not its prototype, getters as getters, or non-enumerable properties. Spreading null or undefined into an object is allowed and does nothing, which makes { ...defaults, ...options } safe when options is missing, but spreading them into an array throws a TypeError.

Properties

Operator
...
Category
Other
Precedence
2 (1 is lowest, 18 is highest)
Associativity
n/a

Syntax

[...iterable]
{ ...object }
func(...args)
function f(...rest) {}

Example

const a = [1, 2], b = [3, 4];
console.log([...a, ...b]);
console.log(Math.max(...b));
console.log([...'hey'], [...new Set([1, 1, 2])]);

const defaults = { theme: 'light', size: 'm' };
console.log({ ...defaults, size: 'l' });

function sum(...nums) { return nums.reduce((t, n) => t + n, 0); }
console.log(sum(1, 2, 3));

Browser Support

The following information will show you the current browser support for the ... operator. Hover over a browser icon to see the version that first introduced support for this operator.

This operator is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee