You can provide sorta comparison function.
showIt.sort(function(a,b){
return a[1] - b[1];
});
aand b- these are elements from your array. sort expects a return value that is greater than zero, zero, or less than zero. the first indicates that it aprecedes b, zero means that they are equal, the last option means bfirst.
source
share