JS Built-ins
URLSearchParamsbeginner

URLSearchParams#toString() β€” serializes params

πŸ“– Usage Example
const p = new URLSearchParams('x=1')
p.delete('z')  // no-op if key doesn't exist

delete() is safe to call even if the key does not exist.

URLSearchParams#toString()

params.toString() returns the params serialized as a query string (without the leading ?).

Challenge: Verify the serialized output.

πŸ’‘ Hints (1)
  • β€’ toString() does NOT include the leading ? character