Skip to content

Instantly share code, notes, and snippets.

@WesleySmits
Created September 23, 2022 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WesleySmits/0e6a9956d4b4c1c3ec16267957968b55 to your computer and use it in GitHub Desktop.
Save WesleySmits/0e6a9956d4b4c1c3ec16267957968b55 to your computer and use it in GitHub Desktop.
URL Object: Construct URL Object Properties
url.hash = 'test'; // 'https://medium.com/@WesleySmits#test'
url.host = 'google.com'; // 'https://google.com/@WesleySmits#test'
url.pathname = '@RandomUser'; 'https://google.com/@RandomUser#test';
url.searchParams.set('key', 'value'); // 'https://google.com/@RandomUser?key=value#test'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment