gil00pita
6/16/2016 - 11:02 PM

The main objective of the spread operator is to spread the objects of an array.

The main objective of the spread operator is to spread the objects of an array.

function myFunc(...val: string[]) {
    //...
}

var values = ['dog', 'cat'];

myFunc('dog', 'cat');

myFunc(...values);
var array1 = [1, 2, 3];
var array2 = [0, ...array1, 4, 5, 6];