30 Days Of JavaScript

Day 29: Mopping up

Lesson 4: Spread Operator

If you have an array or object that you want to split apart you can use the spread operator .... There are a few places to use this but most common is spreading one array into another.

Likewise for spreading an object into another.

You can also use spread along with destructuring.

In the previous destructuring object example you might want to destructure two properties and then spread the rest.

You can see that rest contains the rest of the object properties.

Likewise you can do the same with arrays.

The spread operator is sometimes call the rest operator

Outline

Go Pro?

Upgrade to Pro for quizzes, tracked progress and a completion certificate for just $25 🚀

Want more developer tips, tricks and tools?
Then follow me:
FREE Coding Career Quick Start Guide 🚀
Discover the best way to learn to code, how to land a job and valuable resources to help your journey in this free 15 page value packed guide.
Looking to email me? You can get me on my first name at allthecode.co