search
URL: search
From MDN: "The search property of the URL interface is a search string, also called a query string, that is a string containing a '?' followed by the parameters of the URL."
Notes & further reading
searchParams is usually a better alternative
Always includes the initial
?
valueSpec: URL Standard
MDN: URL.search
Example value:
const url = new URL("https://elide.dev/?one=two#hello");
url.search;
← "?one=two"
Content copied to clipboard
See also
for a more convenient way to access the query parameters.