View Single Post
  #1 (permalink)  
Old February 10th, 2004, 04:29 PM
rgalehouse rgalehouse is offline
Registered User
Join Date: Oct 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.