i have an object variable with nested keys like this
const obj = {
kitchen: {
painting: 100,
piano: 1000,
signature: "",
},
bathroom: {
stereo: 220,
signature: "",
},
signature: "",
};
i want to created a function that changes the value for the key "signature" with a name in both the root obj and any nested object that has a key "signature".
so:
function addSignature( obj , name){
}
returns
newObj = {
kitchen: {
painting: 100,
piano: 1000,
signature: name,
},
bathroom: {
stereo: 220,
signature: name,
},
signature: name,
};