Skip to content

Instantly share code, notes, and snippets.

@ajmeese7
Created May 24, 2022 01:14
Show Gist options
  • Save ajmeese7/b55a3d92e2c86f50a9e766ebc481ccaf to your computer and use it in GitHub Desktop.
Save ajmeese7/b55a3d92e2c86f50a9e766ebc481ccaf to your computer and use it in GitHub Desktop.
Gets the root of a domain from a URL in JavaScript
const baseURL = (url) => url.split("//")[1].split("/")[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment