# Spread Operator

```javascript
console.log([1,2,3]); // [1, 2, 3]
console.log(...[1,2,3]); // 1 2 3
```

## Use Case 1

```javascript
var arr1 = [1,2,3];
var arr2 = [4,5,6];

// arr1.push(arr2) or [1,2,3, arr2]
// console.log(arr1); //  [1, 2, 3, [4, 5, 6]]

arr1.push(...arr2)
console.log(arr1); //   [1, 2, 3, 4, 5, 6]
```

## Use Case 2

```javascript
function display(a,b,c){
    console.log(a+b+c); //  60
}

display(...[10,20,30]);
```

## Use case 3 - Create copy of array

```javascript
var arr1 = [1,2];
var arr2 = [3,4];

var newArr = [...arr1, ...arr2];
var arrCopy = [...newArr]; // Old way [].concat(newArr)

arrCopy[0] = 100;

console.log(arrCopy); [100,2,3,4]
console.log(newArr); [1,2,3,4]
```
