I have a function that I want to pass a variable that contains the path to an object's property. This path will change depending on where the function is being called from. I can't figure out how to save the path in a variable.
I need to save data.a.b.c in 'x'. I need to store the path to access 'c' in 'y' ( I assume using bracket notation)
function
y = [a.b.c]
calculate(data, y)
calculate = function(data, y) {
x = data[y]
}