Javascript Get Number Of Duplicates In Array Python