DEV Community

loading...

Discussion on: Daily Challenge #89 - Extract domain name from URL

Collapse
saikiran profile image
Sai Kiran

No regex needed

 function domainName(url){
     return url.split("/")[2].split(".").slice(-2)[0]
 }