I have an array and want to access its data. However, I need to use a variable instead of the name to access the data.
For example;
My data:
$scope.myData = {
    "user": [
        {   child[{......}],
            ..........
        }
    ],"user2": [
        {   
            child[{......}],
             .........
        }
    ],...........
The following works
 console.log("lenght:"+$scope.myData.user[0].child.length);
but I want to use a variable instead of user[0], because it is dynamic, it changes every time.
Similar to
  var m=user;
  console.log("lenght:"+$scope.myData.m[0].child.length);
 
     
    