Spreading an array

The spread operator ... inserts the elements of an array into another array.

Loading TypeScript...

You can use the spread operator with push to append an array of elements to an existing array, without needing to continuously generate a new array as you would with concat.

Loading TypeScript...

Was this page helpful?