Im wokring on a bit of functionality that works a lot with multidimensional arrays. What I would like to do is sort by the first value then sort by the second value while keeping the first value sorted. See example:
arrayToSort = [[1,5],[1,3],[1,2],[1,6],[2,6],[1,9],[1,11]];
I would like to sort this so it returns
[[1,2],[1,3],[1,5],[1,6],[1,9],[1,11],[2,6]];
I have created* a function to sort the array by the first value using the function below but im unsure how exactly i can achieve the above.
function sortOne(cards){
arr = cards.sort(function(a,b) {
return a[0] > b[0];
});
return arr;
}