Prime Minister Boris Johnson won a thundering election victory that will allow him to take Britain out of the European Union in a matter of weeks.