JSFiddle - React, Tailwind, and code Playground

HTML

<h1>

</h1>

JavaScript

let text = "";

try {
   text = new URL(`https://"google.com`).toString();
}
catch (err) {
   text = err.toString();
}

document.querySelector('h1').innerHTML = text;