Destructuring.
// deestructuring arrays
const arr = [1, 2, 3, 4, 5, 7];
const arr2 = [10, 20]
arr = [...arr, ...arr2]
// destructuring a part arrays
const [a, b, ...arr] = [1, 2, 3, 4, 5, 7];
console.log(a, b); // 1, 2
console.log(arr); // [3, 4, 5, 7]
// destructuring exclude positions 0, 1, 2
const [,,, ...without123] = [1, 2, 3, 4, 5, 7];
console.log(without123) // [4, 5, 7]
// destructuring only get position 0 and 4
const [zero,,,four] = [1, 2, 3, 4, 5, 7];
console.log(without123) // [4, 5, 7]
// destructuring only get position 0 and 3
const [one,,,four] = [1, 2, 3, 4, 5, 7];
console.log(one, four) // [1, 4]
// destructuring add a position in the end or at first
const array = [1, 2, 3, 4, 5, 7];
const stringAfterArray = [ ...array, 'atEnd' ]
const stringBeforeArray = [ 'atFirst', ...array ]
console.log(stringAfterArray) // [1, 2, 3, 4, 5, 7, 'atEnd']
console.log(stringBeforeArray) // ['atFirst', 1, 2, 3, 4, 5, 7]