I'm totally new to javascript, in fact I started last week, and so I'm a total noob...
I have three arrays that I want to compare, and find the records that are in all three. Each Array is linked back to drop down boxes in my browser. If I select "High School" from my school dropdown box, "1984" from my second dropdown box, and "male" from my third dropdown box, I want to load "Bob" and "George" into a fourth array that is for another dropdown box.
I am currently doing this by looping through each selected school record, comparing it to each selected year record, and then if I have a match, comparing it to each selected nametype record. This seemed to work fine until I got six thousand different names. Is there a better way to compare arrays?
I have three arrays that I want to compare, and find the records that are in all three. Each Array is linked back to drop down boxes in my browser. If I select "High School" from my school dropdown box, "1984" from my second dropdown box, and "male" from my third dropdown box, I want to load "Bob" and "George" into a fourth array that is for another dropdown box.
I am currently doing this by looping through each selected school record, comparing it to each selected year record, and then if I have a match, comparing it to each selected nametype record. This seemed to work fine until I got six thousand different names. Is there a better way to compare arrays?
Code:
Schools['High School'][0]='Bob'
Schools['High School'][1]='George'
Schools['Middle School'][0]='Jill'
Schools['Middle School'][1]='Joseph'
Schools['Pre-School'][0]='Larry'
Years['1984'][0]='Bob'
Years['1984'][1]='George'
Years['1985'][0]='Jill'
Years['1985'][1]='Joseph'
Years['1986'][0]='Larry'
NameType['Male'][0]='Bob'
NameType['Male'][1]='George'
NameType['Crossdresser'][0]='Jill'
NameType['Female'][0]='Joseph'
NameType['Female'][0]='Larry'