I create an object with multiple properties -
var objOpts = {
option1: \'Option1\',
option2: \'Option2\',
option2: \'Option3\'
};
I t
I would also supply a more modern method than Mauno Vänä:
function deleteProps (obj, prop) {
for (const p of prop) {
(p in obj) && (delete obj[p]);
}
}
Example:
// Create sample object
const myObject = {
a: 'Foo',
b: 'Baa',
c: 'Oof'
};
// Prints: {a: "Foo", b: "Baa", c: "Oof"}
console.log(myObject);
// Delete props
deleteProps(myObject, ['a', 'b']);
// Prints: {c: "Oof"}
console.log(myObject);