Sortuj String 2D tablica w JavaScript
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
Seun Ajayi