JS Built-ins
URLSearchParamsintermediate

URLSearchParams Constructor β€” from URL.searchParams

πŸ“– Usage Example
new URLSearchParams() instanceof URLSearchParams  // β†’ true

URLSearchParams instances can be checked with instanceof.

URLSearchParams Constructor β€” from existing params

new URLSearchParams(url.searchParams) copies params from a URL's searchParams property.

Challenge: Copy a URL's search params and verify the values.

πŸ’‘ Hints (1)
  • β€’ Passing url.searchParams to the URLSearchParams constructor creates a snapshot β€” mutations to the copy do not affect the original URL.