Javascript Compare Array Of Objects For Counting