Array Count Same Values Javascript Function