I have an Array of string elements and I need to find how many times a elements occured in a Array. my Array is following: var x=["water","water","water","land", "land","land","land","forest"];
I need to know which element is prominent in Array. I have tried to use example from this discussion "Counting the occurrences of JavaScript array elements". But I did not get any expected result. Please help me to find a possible solution. :-)