Distribución de operador de operador JavaScript

// Spread Operator Shorthand javascript
// Longhand
// joining arrays
const odd = [1, 3, 5];
const nums = [2 ,4 , 6].concat(odd);
console.log(nums); // [ 2, 4, 6, 1, 3, 5 ]

// cloning arrays
const arr = [1, 2, 3, 4];
const arr2 = arr.slice()
console.log(arr2); // [ 1, 2, 3, 4 ]

// Shorthand: 
// joining arrays
const odd_ = [1, 3, 5 ];
const nums_ = [2 ,4 , 6, ...odd_]; //spread operator is simply a series of three dots.
console.log(nums_); // [ 2, 4, 6, 1, 3, 5 ]

// cloning arrays
const arr_ = [1, 2, 3, 4];
const arr2_ = [...arr_];
console.log(arr2_); // [ 1, 2, 3, 4 ]

// Unlike the concat() function, you can use the spread operator to insert an array anywhere inside another array.
const odd__ = [1, 3, 5 ];
const nums__ = [2, ...odd__, 4 , 6];
console.log(nums__); // [ 2, 1, 3, 5, 4, 6 ]

// You can also combine the spread operator with ES6 destructuring notation:
const { a, b, ...z } = { a: 1, b: 2, c: 3, d: 4 };
console.log(a) // 1
console.log(b) // 2
console.log(z) // { c: 3, d: 4 }
Chetan Nada