I have this array containing multiple values of three same strings. But I only want one value from each of the repeated strings and the number of times they are repeated.
For example, from the below array I want the output to be { s: 2, d: 10, p: 4 }
["s", "s", "d", "d", "d", "d", "d", "d", "d", "d", "d", "d", "p", "p", "p", "p"]
I have tried using few loops but I don't know how to get the results I want