I create an object with multiple properties -
var objOpts = {
option1: \'Option1\',
option2: \'Option2\',
option2: \'Option3\'
};
I t
ES6 provides an elegant solution to this: Rest in Object Destructuring:
let { a, b, ...rest } = { a: 10, b: 20, c: 30, d: 40 };
console.log(rest); // { c: 30, d: 40 }
Note that this doesn't mutate the original object, but some folks might still find this useful.
Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment