I want to create array of array using given record.

```
user_permission =
 [ { _id: 1,
    description: 'chairman list',
    main_module: 'admin',
    sub_module: 'admin' },
  { _id: 2,
    description: 'create chairman get method',
    main_module: 'admin',
    sub_module: 'admin' },
  { _id: 3,
    description: 'create chairman post method',
    main_module: 'admin',
    sub_module: 'admin' },
  { _id: 4,
    description: 'chairman list post',
    main_module: 'chairman',
    sub_module: 'chairman' },
  { _id: 5,
    description: 'vendor list',
    main_module: 'vendor',
    sub_module: 'vendor' },
  { _id: 6,
    description: 'vendor list post',
    main_module: 'vendor',
    sub_module: 'vendor' } ]

```

using this array i want to result this type array of array like given example

```
[ 
    [ 'admin > admin': { '1': 'chairman list' },
                       { '2': 'create chairman get method' },
                       { '3': 'create chairman post method' } 
    ],
    [ 'chairman > chairman': { '4': 'chairman list post' } 
    ],
    [ 'vendor > vendor': { '5': 'vendor list' },
                         { '6': 'vendor list post' } 
    ] 
]

```

use the foreach and get the result but i don't have create proper array 

```
user_permission.forEach(function(data){
    var mainmodule = [[data.main_module]+" > "+[data.sub_module]];
    var key = data._id;
    var val = data.description;

    var elem = new Array();
    elem[mainmodule] ={};
    elem[mainmodule][key] = val;
    user_prems.push(elem);
})

```

result of foreach is below:-

```
[ 
    [ 'admin > admin': { '1': 'chairman list' } ],
    [ 'admin > admin': { '2': 'create chairman get method' } ],
    [ 'admin > admin': { '3': 'create chairman post method' } ],
    [ 'chairman > chairman': { '4': 'chairman list post' } ],
    [ 'vendor > vendor': { '5': 'vendor list' } ],
    [ 'vendor > vendor': { '6': 'vendor list post' } ] 
]

```