ES6 Lesson #3 - Spread operator

ES6 was invented to reduce code. Spread operator, which was added in es6, serves precisely these purposes. It allows you to expand the array, which is very nice if you need to insert its data into another array.

Simple Example:

let sobakagavkaetnogami = ["valera", "nastalo", "tvoi", "vremya"];
let isvalera = ["ye", "valera", "is"];

console.log([...sobakagavkaetnogami, ...isvalera]) 
// returns ["valera", "nastalo", "tvoi", "vremya", "ye", "valera", "is"]

As u see on example, u can easly concat 2 arrays in one with spread operator. In another case u can transfer data to functions:

var dateFields = [1970, 0, 1];  // 1 Jan 1970
var d = new Date(...dateFields);