Sorting 2 dimensional array
In JavaScript to sort a single demensional array named 'users' we use the sort method as follows --> users.sort();
Let's say we have a two dimensional array named 'users' with three fields defined as follows,
users[indx] = new Array();
users[indx][0] = name;
users[indx][1] = dept;
users[indx][2] = date;
The default sort for two demensional arrays seems to sort by the first field, ie name. Is it possible to sort by another field, ie dept or date. What is the syntax.
|