https://stackoverflow.com/questions/8498592/extract-hostname-name-from-string
1 2 3 4 5 6 7 | const getHostname = (url) => { // use URL constructor and return hostname return new URL(url).hostname; } console.log(hostname); //google.com |
https://stackoverflow.com/questions/8498592/extract-hostname-name-from-string
1 2 3 4 5 6 7 | const getHostname = (url) => { // use URL constructor and return hostname return new URL(url).hostname; } console.log(hostname); //google.com |