const obj = {a:10,b:{d:{e:50,f:60}}}
// c:[20,30,40],
function clone(val){
if(typeof val === "object"){
return
}
}
let value = Object.keys(obj).map(function abc(item){
if(typeof val === "object"){
return {[item]:{...abc(item)}}
}
return {[item]:obj[item]}
}).reduce((acc, curr)=> {
//console.log(acc, curr)
return {...acc, ...curr}
}, {})
//value =
value.b.d.e = 100
console.log(value, obj)
To embed this project on your website, copy the following code and paste it into your website's HTML: