So I have an array. The array has string values inside that can change each time:
var array = ['1','2','3','4','5'];
or sometimes:
var array = ['1','4','3','4','4'];
or even:
var array = ['1','3','3','4','4'];
How would I go about iterating through this array, figuring out which value is present the most and then displaying it. Also, how would I go about making it even smarter to understand that sometimes there is a tie between two values, as is the case in the last array above, and then displaying info notifying me that values “3” and “4” are tied… Or if there is no value that occurs more than once, thus displaying all values. Thoughts?
Try this: