I have an object with a lot of properties, lets say:
obj1={a:1, b:2,..., z:-1};
I want to separate a group of properties as follow:
obj2={a:1, h:25, w:3};
obj3={rest of properties};
What i am doing is:
const {a,h,w,...obj3} = obj1;
const obj2={a,h,w};
is this the only way to achive this? is there a way to ignore properties that are undefined? For example let say h is undefined, so ideally obj2 would only be obj2={a,w} It is possible that in the future obj1 will grow and that means i will have to add the new properties in both lines of my approach.