Combining arrays with the spread operator

We have seen how to use some new syntax to extract elements from an array. Not to be left out, there are also some new facilities for combining arrays. Helpfully, as we'll see, the use of the spread operator mirrors that of the rest operator.

In this recipe, we'll take a look at how to use the spread operator to combine arrays.

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.