How to set url search params in JavaScript

URL
By Jad Joubran · 
Last updated Mar 04, 2018
const url = new URL(document.location);

url.searchParams.set("lang", "en");

console.log(url.href);
https://codetogo.io/how-to-set-url-search-params-in-javascript/?lang=en