I have an array of objects that contain arrays of objects:
Code:
var a = [
  {group:"abc",data:[
    {id:123,title:"Title of item"},
    {id:456,title:"Title of item"},
    {group:"def",data:[
      {id:789,title:"Title if item"},
      {id:101,title:"Title of item"}
    ]}
  ]}
];
There's no limit to how deeply this could be nested. I use a recursive function to loop through the array. In each iteration, I check if there's a data array and initiate the loop on that specific data array:
Code:
function looper(sourcearray) {
  for(var i = 0, len = sourcearray.length; i < len; ++i) {
    //do stuff
    if(typeof sourcearray[i].data !== 'undefined' && sourcearray[i].data.length > 0) {
      looper(sourcearray[i].data);
    }
  }
}
Lets say that I'm 3 levels 'deep' in the array. Is there a way for me to determine the 'path' to where I am?

For example, if the array 'path' is: a[1][3][1]

Is there a way for me to obtain some sort of reference to that array path?

I hope my question is clear - this is a bit of a tough one for me for some reason (could it be because it's Monday?)