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?

If you upgraded to pro, sign in here

  • About
  • Blog
  • Privacy
Looking to email me? You can get me on my first name at allthecode.co