How to get url search params in JavaScript

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

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