How it works...

The first element saturnV works in the same manner as the preceding recipe. The rest operator indicates that the remaining elements should be assigned to the otherRockets variable. Since it isn't necessarily a single element, this will be an array.

It should be noted that the rest operator must be the last member of the destructuring syntax. If it is followed by a comma, you will receive a parse error.

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.