JSFiddle - React, Tailwind, and code Playground
by iamruss
JavaScript
function parseUrl(url) {
var parser = document.createElement('a');
parser.href = url;
return(parser.hostname);
}
var host = parseUrl('http://example.com:3000/pathname/?search=test#hash');
document.write(host);