occurrence in an array

occurrence in an array

Hi,

I am trying to find the occurrence of numbers in an array, I want to display each number and how many times it is occurred in an array, I tried this :



1) using console.log it is working, but the numbers are repeated.

2) when tried to display using div it does not work.

Thanks, your help is appreciated.