Currently, I got an array like that:
var uniqueCount = Array();
After a few steps, my array looks like that:
uniqueCount = [a,b,c,d,d,e,a,b,c,f,g,h,h,h,e,a];
How can I count how many a,b,c are there in the array? I want to have a result like:
a = 3
b = 1
c = 2
d = 2
etc.
Create a file for example
demo.js
and run it in console with nodedemo.js
and you will get occurrence of elements in the form of matrix.You will get result in console as below:
Demo Fiddle
Duplicates in an array containing alphabets:
Duplicates in an array containing numbers:
You can do something like that:
now you have a map with all characters count