Suppose I have an object that looks like this:
var object = {
property: {
deeper: {
deepProperty: '1234'
}
}
}
I want to write a function that parses strings with dots in them into their appropriate deeply nested object value:
function prop(str) {
// Should return the nested object value based on the string
}
For example:
prop('property.deeper.deepProperty')
// Should return: '1234'