0

I want to access the values of a nested object from a loop, and I have a stored array of properties comma separated.

Problem is my result looks like this,

["a,b"]

And im looking for this.

["a"]["b"]

Properties :

var props = ["a,b","f"];

JSON :

[
    { a: 
        { b: ''
          c: {
                d: '',
                e: ''
             }
        }
       f: ''
    }
]

For each :

props.forEach(function (prop, i) {

    var property = prop.split(",");
    console.log(property);

});
hyperdrive
  • 1,786
  • 5
  • 19
  • 33

0 Answers0