Elemen JavaScript yang tersisa dari array ke variabel menggunakan sintaks penyebaran

const arrValue = ['one', 'two', 'three', 'four'];

// destructuring assignment in arrays
// assigning remaining elements to y
const [x, ...y] = arrValue;

console.log(x); // one
console.log(y); // ["two", "three", "four"]
SAMER SAEID