Exclua várias chaves do objeto 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}
Worried Willet
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}
const obj = {
a: 'dog',
b: 'cat',
c: 'mouse',
d: 'cow',
e: 'horse',
};
const {a, e, ...updatedObject} = obj;
// output
console.log(updatedObject)