DEV Community 👩‍💻👨‍💻

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

Collapse
saikiran profile image
Sai Kiran • Edited on

No regex needed

 function domainName(url){
     return url.split("/")[2].split(".").slice(-2)[0]
 }
Enter fullscreen mode Exit fullscreen mode
Collapse
benyam profile image
BenyamWorku

doesn't work