gdlp2004
asked on
Comparing Arrays
Hello.
I have been working with this a little while and because I am a little "rusty" with my javascript, I can't figure it out. Here is what I am trying to do, I have to arrays:
testSpecifyList = ('APR','DRE','TAB');
specCompareArray = ('APR','DRE','DRE');
I am trying to compare testSpecifyList and specCompareArray in two different ways. The first being if specCompareArray has any duplicates. (FYI, testSpecifyList will NEVER have duplicates so I don't need to check that.)
The second is, is there a one to one with testSpecifyList to specCompareArray. Does everything in testSpecifyList match what is in specCompareArray? What would be the best is if you could leave the array with the one that doesn't exists. So, using the example it would look something like this:
if(testSpecifyList[0]==spe cCompareAr ray [0])
testSpecifyList[0]=null;// not sure if you can do this
specCompareArray [0]=null;
So at the end of the loop it would display:
testSpecifyList.length=0
specCompareArray.length=1
Any help is greatly appreciated. Thanks in advance!
I have been working with this a little while and because I am a little "rusty" with my javascript, I can't figure it out. Here is what I am trying to do, I have to arrays:
testSpecifyList = ('APR','DRE','TAB');
specCompareArray = ('APR','DRE','DRE');
I am trying to compare testSpecifyList and specCompareArray in two different ways. The first being if specCompareArray has any duplicates. (FYI, testSpecifyList will NEVER have duplicates so I don't need to check that.)
The second is, is there a one to one with testSpecifyList to specCompareArray. Does everything in testSpecifyList match what is in specCompareArray? What would be the best is if you could leave the array with the one that doesn't exists. So, using the example it would look something like this:
if(testSpecifyList[0]==spe
testSpecifyList[0]=null;//
specCompareArray [0]=null;
So at the end of the loop it would display:
testSpecifyList.length=0
specCompareArray.length=1
Any help is greatly appreciated. Thanks in advance!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.