The most practical way to delete multiple attributes in an object

1.let obj = {K1RV "banana", K2RU "Apple", K3RU "orange"};

2. What"s a good way to delete both K2 and K3 attributes in obj.

Feb.28,2021

delete one by one

let obj = {k1:'', k2:'', k3:''}
function delKey(obj, ...args) {
    args.forEach(v => {
        delete obj[v]
    })
    return obj
}
delKey(obj,'k2','k3')
Menu