I have the following JS code:
let obj1 = {
prop1: 1,
prop2: 2,
prop3: 3,
prop4: 4
}
let obj2 = {
prop1: obj1.prop1,
prop2: obj1.prop2,
}
Here I create obj2
which has certain select properties of obj1
. Is there a cleaner/quicker way to do this than what I've done here? Some kind of destructuring hack?