igorz,
var mas = [
["1", "Mike"],
["1", "Mike"],
["2", "John"],
["3", "Bob"],
["1", "Mike"],
["3", "Jim"]
];
mas.sort(function(a,b) { return a[0] - b[0]})
var result = [],len = mas.length - 1, n = mas[len][0];
for (var i= len; i > -1; i--) {
if (n != mas[i][0]) {n = mas[i][0]; result.unshift(mas.splice(i+1,mas.length-i+1))} }
result.unshift(mas)
alert(JSON.stringify(result))
var data = [["Name","1"],["Name","2"],["Name","1"],["Name","2"],
["Name","5"],["Name","2"],["Name","1"],["Name","3"],["Name","3"],["Name","2"]];
data.sort(function(a,b) { return a[1] - b[1]})
var result = [],len = data.length - 1, n = data[len][1];
for (var i= len; i > -1; i--) {
if (n != data[i][1]) {n = data[i][1]; result.unshift(data.splice(i+1,data.length-i+1))} }
result.unshift(data)
alert(JSON.stringify(result))