Basscyst
10-04-2003, 10:22 PM
Is there a method for retrieving the number of times a string is present in an array? I have a one word string per array element. I just need to count how many times each word is present. Any Ideas? Can't seem to figure it out.
Code:
<script language="javascript">
list=new Array();
list[0]=bob;
list[1]=frank;
list[2]=bob;
list[3]=lisa;
list[4]=dan;
list[5]=frank;
</script>
NOTE: The actual array is much larger and is populated from a database so I don't actually know what is in the array until the page loads. I don't think that would matter though.
Code:
<script language="javascript">
list=new Array();
list[0]=bob;
list[1]=frank;
list[2]=bob;
list[3]=lisa;
list[4]=dan;
list[5]=frank;
</script>
NOTE: The actual array is much larger and is populated from a database so I don't actually know what is in the array until the page loads. I don't think that would matter though.