let obj = {
user1: {
name: 'петя',
age: 23,
},
user2: {
name: 'иван',
age: 23,
},
}
function clear_key(obj, k) {
if(obj && k) {
Object.keys(obj).forEach(key => {
obj[key][k] = undefined;
});
return;
}
throw 'Object and key is required';
}
function clear_key(obj, k) {
if(obj && k) return Object.keys(obj).forEach(key => obj[key][k] = undefined);
throw 'Object and key is required';
}