I have an array like this
var array = [{
order: 3,
sub - array: [{
order: 2
},{
order: 1
}]
},{
order: 2,
sub - array: [{
order: 2
},{
order: 1
}]
}];
Now I want to sort the the complete collection on the attribute order
, so both the outer
as well as inner arrays should get sorted based on the attribute order.
The final output should look like this.
var array = [{
order: 2,
sub - array: [{
order: 1
},{
order: 2
}]
},{
order: 3,
sub - array: [{
order: 1
},{
order: 2
}]
}];