MozillaZine

Sort Multidimentional Array

Closed Forum
rangsit
Guest
 

Post Posted September 8th, 2006, 7:16 am

Hi there, i got a problem about how to sort a multidimentional array. The following is the example of multidimentaional array.

var hospital = [["HospitalA",numA,"James Smith"],
["HospitalB",numB,"Peter Smith"],
["HospitalB",numB,"Jim Thompson"],
["HospitalC",numC,"Richard Scott"]]

and var numA=0.21, numB=3.21, numC=2.41, numD=4.01

I wanna sort the all numbers which is index 1 of each line, hospital[i][1]. I really need help. Thx in advance.

Daifne
Moderator

User avatar
 
Posts: 122994
Joined: July 31st, 2005, 9:17 pm
Location: Where the Waters Meet, Wisconsin

Post Posted September 8th, 2006, 9:01 am

Moving to Miscellaneous Support. But we probably still won't do your homework for you.

old zmanzero
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted September 9th, 2006, 11:28 am

rangsit, will you post the grade you get on the test? the curious want to know. i really don't know the answer or i would post it.

trolly
Moderator

User avatar
 
Posts: 39864
Joined: August 22nd, 2005, 7:25 am

Post Posted September 11th, 2006, 1:05 am

Exactly the same way you sort "normal" arrays, just swapping arrays instead of numbers here.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.

Return to Miscellaneous Support


Who is online

Users browsing this forum: No registered users and 1 guest