I would like to extract the base domain from the url in javascript. For example for the list of urls listed below I need to get google.com (or googl
document.location.origin
Result: "https://stackoverflow.com"
document.location.hostname
Result: "stackoverflow.com"
document.location.pathname
Result: "/questions/6449340/how-to-get-base-domain-from-the-url-in-javascript/58887093"