Preview:
//const url = require('url');

const myUrl = new URL('http://mywebsite.com/hello.html?id=100&status=active');

// Serialized URL
console.log('Serialized URL: ' + myUrl.href);
console.log('Serialized URL: ' + myUrl.toString());

// Host (root domain)
console.log('Host: ' + myUrl.host);

// Hostname ( does not get port ex. 8000 from http://mywebsite.com:8000/hello.html?id=100&status=active )
console.log('Hostname: ' + myUrl.hostname);

// Pathname
console.log('Pathname: ' + myUrl.pathname);

// Serialized query
console.log('Serialized query: ' + myUrl.search);

// Parameter object
console.log(myUrl.searchParams);

// Add param to parameter object
myUrl.searchParams.append('abc', '123');
console.log(myUrl.searchParams);

// Loop through params
myUrl.searchParams.forEach((value, name) => {
    console.log(`${name}: ${value}`);
})
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter