CoverT 48: Object Rest Destructuring

codeInteractive Code Example

Object destructuing is great! Found a clean way to pick some specific properties from an object, and then assign the rest of the properties to another object.

const myObj = { a: 1, b: 2, c:3, d: 4 };
const {
  a: first,
  c: third,
  ...theRest
} = myObj;

console.log(first); // 1
console.log(third); // 3
console.log(theRest); // { b: 2, d: 4 }