const url = new URL('https://example.com/?firstkey=firstvalue&secondkey=secondvalue'); for( const [key, value] of Array.from(url.searchParams.entries())) { console.log(key) console.log(value); }