Hi I've an array like this
var a = [5, 5, 5, 2, 2, 2, 2, 2, 9, 4];
my goal is to count the unique value and have a report about any items on it so the result's well be
Array [
[5, 3],
[2, 5],
[9, 1],
[4, 1]
]
I found a solution, that can be found in this other post [Counting the occurrences of JavaScript array elements
The @Emissary solution's for me is the best, the problem is that this solution go over and add some new function that I don't need and I can't reply directly to that post to ask how to have only the array that I need :D
@Emissary add the
console.log(key + ': ' + val)
My first idea was, instead console.log I can push every value in 2d array, but I don't think is a good idea, because if I have understand well the @Emissary solutions, the very 1st part of the solution create exactly the array that I need.
Any idea how to "isolate" this particular array?