I have an object like this:
var myObj = { first: { sub: { level: "some text", level2: "some more text" }, sub2: { level3: "Something" } }, second: { stuff: "More stuff...lots of stuff" } }
what i want to do is say
delete myObj.first.sub.level
But I will not know what is being transmitted, or how many levels I need in order to remove the correct property, that is, simply:
Storage.removeItem('myObj.first'); // This is currently working
Or something more complicated:
Storage.removeItem('myObj.first.sub2.level3');
I’m kind of stuck, because I can get to the point that I have the key "level3", and this is the property "Something", but I can’t figure out how to correctly perform the reverse step to delete the full section of this object.
I need to replicate it to myObj so that I can delete the complete traversed object.
'myObj.first.sub.level3'
If that makes sense ...
source share