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?
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?
Manually handling it would be great trouble. Try this. https://www.npmjs.com/package/object-path