Garmaine Staff asked 2 years ago
This question already has answers here:
http://stackoverflow.com//questions/6491463/accessing-nested-javascript-objects-and-arays-by-string-path”>Accessing nested JavaScript objects and arays by string path (36 answers)
Closed 3 hours ago.

Having

var path = "a.b.c";
var foo = {a: {b: {c: "bar"}}};

How to get the "bar" from foo and path?

Surely the foo['a']['b']['c'] will work but how to get it nicely?