javascript - query object graph?

Posted by Scott on Stack Overflow See other posts from Stack Overflow or by Scott
Published on 2010-06-16T23:38:09Z Indexed on 2010/06/16 23:42 UTC
Read the original article Hit count: 153

Filed under:
|
|

Given an object like this:

var obj = {
        first:{
            second:{
                third:'hi there'
            }
        }
    };

And a key like this "first.second.third"

How can I get the value of the nested object "hi there"?

I think maybe the Array.reduce function could help, but not sure.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about query