var person = {
name: 'Joe',
contact: {
phone: '555'
}
}
var nameOfPerson = person['name']; //Joe
var str = 'contact.phone';
var phoneToPerson = person[str]; //undefined
Is this possible to do somehow? I got some logic where I end up with a string and I need to access a nested property with it.