1 2 3 4 5 6 7 |
const myObject = { a: 1, b: 2, c: 3 }; const { a, ...noA } = myObject; console.log(noA); // => { b: 2, c: 3 } |
1 2 3 4 5 6 7 8 |
const myObject = { a: 1, b: 2, c: 3 }; let key = 'a'; let {[key]: foo, ...noKey} = myObject; console.log(noKey); // => { b: 2, c: 3 } |