const myObj = { x: 1, y: 2, a: 3, b: 4 }; const { x, y, ...z } = myObj; // object destructuring here console.log(x); // 1 console.log(y); // 2 console.log(z); // { a: 3, b: 4 } // z is the rest of the object destructured: myObj object minus x and y properties destructured const n = { x, y, ...z }; console.log(n); // { x: 1, y: 2, a: 3, b: 4 } // Here z object properties are spread into n