The spread operator is three dots (...) that perform several different tasks.
First, the spread operator allows us to combine the contents of arrays. For example, if we two arrays, we could make a third array that combines the two arrays into one.
Example 1:
var arr1 = ['el11', 'el12', 'el13']
var arr2 = ['el21', 'el22', 'el23']
var arr3 = [...arr1, ...arr2] // merge arr1 and arr2 into arr3
console.log(arr3) // [ 'el11', 'el12', 'el13', 'el21', 'el22', 'el23' ]
console.log(arr3.reverse()) //[ 'el23', 'el22', 'el21', 'el13', 'el12', 'el11' ]
var [first] = arr3 // first element of arr3 el12
var [last] = arr3.reverse() // first element of reversed arr3 el23
var cleanA3 = arr3.join(',') // remove braces and inverted commas and separated with , character
console.log(cleanA3) // ar23,ar22,ar21,ar13,ar12,ar11
var [...reset] = arr1 // print all element of arr1 left to the number of word before separated with commas before three dot
console.log(reset) //[ 'el12', 'el13' ]
var [,first,...reset] = arr1
console.log(reset) //[ 'el13' ]