var arr1 = [[1, "Hair Pin"], [21, "Bowling Ball"], [2, "Dirty Sock"], [5, "Microphone"]];
arr1.sort(function (a, b) {
return a[1].localeCompare(b[1]);
});
document.write('<pre>' + JSON.stringify(arr1, 0, 4) + '</pre>');
Run code snippet
/*//*\___________________l4r3f4c3@proton.me________________/|**/
/**/ Array.prototype.sort2d = function(column) { //
/**/ column = typeof column === "undefined" ? 0 : column //
/**/ return this.sort((a, b) => a[column]-b[column]); } //
/**/ const unsorted2DArray = [[3,1,1,1],[9,3,3,3],[6,2,2,2]] //
/**/ sorted2DArray = unsorted2DArray.sort2d() //
/**/ //sorted2DArray = [ [3,1,1,1],[6,2,2,2],[9,3,3,3] ] //
/*//*======================/*//*/=========================/||*/
var arr = [[12, 'AAA'], [12, 'BBB'], [12, 'CCC'],[28, 'DDD'], [18, 'CCC'],[12, 'DDD'],[18, 'CCC'],[28, 'DDD'],[28, 'DDD'],[58, 'BBB'],[68, 'BBB'],[78, 'BBB']];
arr.sort(function(a,b) {
return a[0]-b[0]
});