I'm trying to access a property of an object dynamically with a string. For example: ".id.public" -> anyObject["id"]["public"]
The problem - I don't know how many arguments I have (for example ".id" or ".id.public" or ".id.public.whatever".
I made a little workaround:
var currentSplit = anyObject;
var splitted = "id.public".split("\.");
splitted.forEach(function(s) { currentSplit = currentSplit[s]; });
When I try now to override the object property I will override the reference and not the object property.
currentSplit = "test";
I tried already stuff like anyObject["id.public"] = "test";
but it didn't work.