JS Built-ins
URLbeginner

URL Properties β€” hash and origin

πŸ“– Usage Example
const u = new URL('https://example.com?a=1')
u.searchParams.get('a')  // β†’ '1'

searchParams gives a URLSearchParams object for convenient query string manipulation.

URL Instance Properties β€” hash & origin

hash is the fragment including #. origin is protocol + hostname + port.

Challenge: Check hash and origin on various URLs.

πŸ’‘ Hints (1)
  • β€’ hash includes the # character; origin never includes path or query