The rest and spread operator in ES6
August 12, 2017 Leave a comment
ES6 comes with a new operator that consists of three dots: … It is strongly related to arrays. It has two major purposes:
- It allows a function to have an arbitrary number of parameters of a certain type. This is the same as a parameters array in a C# or a Java function with varargs
- Join arrays in an elegant way
Let’s see how the … operator works.