switch javascript to handle players in a map not a list