I want a method in javascript that gets a string as its arguments and return a value from a nested object like as:
var obj = {
place: {
cuntry: 'Iran',
city: 'Tehran',
block: 68,
info: {
name :'Saeid',
age: 22
}
}
};
function getValue(st) {
// st: 'place[info][name]'
return obj['place']['info']['name'] // or obj.place.info.name
}