Count Distinct Elements In Array Javascript Length