Spread Operator
1 min readSep 4, 2015
Spread operator (…) spread array to it’s individual items
let arr = [1, 2, 3];
let arr2 = [4, 5, 6];
console.log(arr);//[1, 2, 3]
console.log(…arr);//1 2 3
let arr3 = […arr2, 7, 8, 9];
console.log(arr3);//[4, 5, 6, 7 , 8, 9]
function calculate(a, b, c){ return a + b + c;
}
console.log(calculate(…arr));//6
console.log(calculate(…arr2));//15