delete multiple key from complexe object javascript code example
Example 1: delete multiple keys from object javascript
var obj = {a: 1, b: 2, c: 3, d: 4, e: 5 };
['c', 'e'].forEach(e => delete obj[e]);
// obj is now {a:1, b:2, d:4}
Example 2: delete multiple keys from object javascript
const obj = {
a: 'dog',
b: 'cat',
c: 'mouse',
d: 'cow',
e: 'horse',
};
const {a, e, ...updatedObject} = obj;
// output
console.log(updatedObject)