say I have an object like this:
a : {
a1 : {
a2: true
}
}
and I have all the path saved in an array:
[a1, a2]
If I want to assign value to a["a1"]["a2"], it is easy:
a["a1"]["a2"] = true;
However when I have a 3 level path like this:
[a1, a2, a3]
I have to manually write the code like this:
a["a1"]["a2"]["a3"] = true;
Is there a way to automatically handle any level of paths so that I don't have to make it explicit for every single case?
Note that "a" can be quite complex so I only want to assign value to this specific element and without touching the rest.