For instance, I have this object:
const payload = {
apple: 1,
dog: 2,
cat: 3
}
and I want to destructure it into a new object that only contains apple
and dog
:
const newPayload = {
apple:1,
dog: 2
}
Something like:
const {{apple, dog} : newPayload} = payload
Obviously the above is wrong, but wondering if there is a way to do something like this.
Thanks!