What is the best way to convert an array of strings to access an objects property?
For example:
var obj = {
a: {
b: {
c: 4
}
}
};
I have an array
var arr = ['a', 'b', 'c'];
What is the most efficient to iterate through the array to get 4 with just accessing obj?
This is with not knowing how many dimensions the object has.