I have been thinking for quite some time now on how to sort my array in Javascript in the way I want to, trying various methods and I can't come up with a solution so I decided to ask here... So in a nutshell, my array looks as complex as that:
var englishvoc = new Array();
englishvoc[0] = new Array();
englishvoc[0][0] = "beautiful";
englishvoc[0][1] = new Array();
englishvoc[0][1][0] = 0;
englishvoc[0][2] = 2;
englishvoc[1] = new Array();
englishvoc[1][0] = "nice";
englishvoc[1][1] = new Array();
englishvoc[1][1][0] = 0;
englishvoc[1][2] = 2;
englishvoc[2] = new Array();
englishvoc[2][0] = "get";
englishvoc[2][1] = new Array();
englishvoc[2][1][0] = 9;
englishvoc[2][1][1] = 7;
englishvoc[2][1][2] = 2;
englishvoc[2][2] = 1;
The way I want this array to be sorted is just by the English word in there, so that the order of them become "beautiful", "get", "nice", while moving the whole first dimensions of the array. Result should be:
alert(englishvoc) //Returns: '"beautiful",0,2,"get",9,7,2,1,"nice",0,2'
In addition to that, it would be great if this sorting system would not be case sensitive... Maybe someone has a solution for that complicated array sorting? Thanks in advance!