How to get url search params in JavaScript

URL
Last updated Mar 04, 2018
//https://codetogo.io?lang=en
const url = new URL(document.location);

const lang = url.searchParams.get("lang");
en