04 Try it yourself Interactive
Give the winner’s percentage of the valid votes, the majority in votes, and what share of the votes cast were invalid. The console derives the loser’s share, the gap, the valid votes and — when there are invalid votes — the total cast, keeping the two bases explicitly separate.