JSFiddle - React, Tailwind, and code Playground
JavaScript
const url = new URL('http://example.com/path/index.html');
console.log(url.hostname); // => 'example.com'
const url = new URL('http://example.com/path/index.html');
console.log(url.hostname); // => 'example.com'