javascript – Compare two array incidents and count

I have two paintings

$ array1 = (18753933, 18753933, 18771982)
$ array2 = (& # 39; 18753933 & # 39;; & # 39; 18771982 & # 39;)

I'm going through each to compare the values ​​that are the same in each table

                                var countArticlesLoaded = 0;
for (var $ i = 0; $ i <$ array1.length; $ i ++)
{
for (var $ j = 0; $ j <$ array2.length; $ j ++)
{

if ($ array1[$i]=== $ array[$j])
{
countArticlesLoads ++;

}
}
}
console.log (count the loaded goods);

The example that I put in my code works well, that is to say that I make the comparison and that it works without problem.

What do I want to do? (That's what I have no idea of ​​how to do it)

As you can see in $ array1 is 18753933 and in the $ array2 there is also 18753933

What I want is that when the value is repeated, it is counted. In the $ table1, the value 18753933 is equal to 2 times and the value 18771982 to 1 time.

I want to see something like this:

18753933 it is repeated: 2
18771982 is repeated: 1

Could you give me an idea of ​​what I miss? I always have trouble making comparisons between tables. Thank you