If we have an object in JS/typescript structured like this:
var obj = {
a: {
b:{
c:1
}
}
}
And a string "b.c"
is given, how can we evaluate this using only the variables provided and retrieve the value 1
from the object without relying on techniques like eval
as typescript would raise concerns?
Appreciate your insights.