-
I'm trying to destructure an object and assign it to another object to spread it, is it possible or already exists another way to do that? |
Beta Was this translation helpful? Give feedback.
Answered by
aduh95
Apr 3, 2021
Replies: 0 comments 2 replies
-
Here's how you can do that: const obj = {a: 1, b: 2, c: 3};
const { a, b } = obj;
const newObj = { a, b }; or const obj = {a: 1, b: 2, c: 3};
const newObj = { a: obj.a, b: obj.b }; Note that Node.js doesn't have control over JavaScript the language, discussion over the language spec is happening in https://github.com/tc39/proposals. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
avivkeller
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's how you can do that:
or
Note that Node.js doesn't have control over JavaScript the language, discussion over the language spec is happening in https://github.com/tc39/proposals.