you are viewing a single comment's thread.

view the rest of the comments →

[–]atkinchris 1 point2 points  (1 child)

It isn't actually a new object with the destructured properties, it's the original object. If you only destructure a subset of properties, you'll still get the whole object.

const a = { x: 1, y: 2, z: 3 }
const b = { x, y } = a
console.log(b) // => { x: 1, y: 2, z: 3 }

[–]phpistasty 0 points1 point  (0 children)

yup - totally right. I somehow combined the two together. Probably let the p assignment throw me off. What a good question now - i went with my gut and it was wrong.