Domain Name From URL

Get domain name from URL using JavaScript

Abhith Rajan
Abhith RajanSeptember 13, 2020 · 1 min read · Last Updated:
export const domainFromURL = (url) => {
  return url
    .replace("http://", "")
    .replace("https://", "")
    .replace("www.", "")

This page is open source. Noticed a typo? Or something unclear?
Improve this page on GitHub

Abhith Rajan

Written byAbhith Rajan
Abhith Rajan is a software engineer by day and a full-stack developer by night. He's coding for almost a decade now. He codes 🧑‍💻, write ✍️, learn 📖 and advocate 👍.

Is this page helpful?

Related ArticlesView All

Related VideosView All

Why pnpm?

Easy NPM Package Updates with Yarn Upgrade Interactive

The Async Await Episode I Promised