I want to sort a multidimensional array using the first row, I want that the second and the third row get the same sort order of the first row
Here is an example of array :
var arr =
[
[1,3,5,6,0,2],
[1,2,7,4,0,6],
[1,2,3,4,5,6]
]
the result that I want =
[
[0,1,2,3,5,6],
[0,1,6,2,7,4],
[5,1,6,2,3,4]
]
I tried the following function but it doesnt work as I want
arr = arr.sort(function(a,b) {
return a[0] > b[0];
});
What's wrong with my function ? Thank you
.sortshould return a number, not a bool.