function getValue(data, path) {
    var i, len = path.length;
    for (i = 0; typeof data === 'object' && i < len; ++i) {
        data = data[path[i]];
    }
    return data;
}
Now if you want to access
a.b.c
var prop = getValue(a, ["b", "c"]);
by გიორგი უზნაძე
4 years ago
JavaScript
Object
3
Pro tip: use ```triple backticks around text``` to write in code fences