JS Built-ins
URLbeginner

URL Properties β€” href and protocol

πŸ“– Usage Example
const u = new URL('https://user:pass@example.com:8080/path?q=1#frag')
u.protocol  // β†’ 'https:'

The protocol property returns the URL scheme including the trailing colon.

URL Instance Properties β€” href & protocol

href returns the full serialized URL. protocol returns the scheme followed by :.

Challenge: Parse 'https://example.com/path' and inspect href and protocol.

πŸ’‘ Hints (1)
  • β€’ protocol always ends with a colon