JS Built-ins
← URL11 / 20
URLbeginner

URL#toString() β€” equals href

πŸ“– Usage Example
const u = new URL('https://example.com/path')
u.toString()  // β†’ 'https://example.com/path'

toString() returns the full serialized URL string.

URL#toString()

url.toString() returns the serialized URL, identical to url.href.

Challenge: Verify that toString() output equals href.

πŸ’‘ Hints (1)
  • β€’ url.toString() and url.href both return the serialized URL