From the course: Learning Functional Programming with JavaScript ES6+

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

The spread operator

The spread operator - JavaScript Tutorial

From the course: Learning Functional Programming with JavaScript ES6+

Start my 1-month free trial

The spread operator

- [Instructor] ES6 offers many syntax improvements over its predecessor CommonJS. In addition to arrow function syntax, which we covered in a previous video, and import export statements, ES6 provides us with a new syntax that's really helpful for dealing with JavaScript objects and arrays. Something that we do a lot of when doing functional programming in JavaScript since these are the main ways that our data is represented in code. This new syntax is called spread operator syntax. To see what the spread operator syntax looks like and how it works, let's imagine that we have two objects. The first object represents a person. We have their name, their age and their hair and eye color. The second object represents career data that we might have about the person. Their job title and the company they work for. What if we wanted to combine these two objects into one object that had all the same properties and values as these two objects? Well, that's exactly what the spread operator helps…

Contents