By means of a regular expression and Greasemonkey I have an array of results that looks like:
choice1, choice2, choice3, choice3, choice1, etc..
My question is how do I tally up the choices so I know how many times choice1 is in the array, choice2 is in the array, etc. if I do not know exactly how many choices there are or what they are.
The ultimate goal is to create a Greasemonkey script that stores the number of votes each choice gets over multiple pages (probably using gm_setvalue although I'm open to other ideas.)
Thanks!