Dev Helpers
← Back

Separate a URL fragment

Separate a URL fragment using Node.js.

Open this example in the interactive library

Source code

import {
  URL,
  domainToASCII,
  domainToUnicode,
  pathToFileURL,
  fileURLToPath,
} from "node:url";
console.log(new URL("https://example.org/doc#usage").hash.slice(1));

Sample output

usage