URL.prototype.search - Node documentation
property URL.prototype.search

Usage in Deno

import { URL } from "node:url";

Gets and sets the serialized query portion of the URL.

const myURL = new URL('https://example.org/abc?123');
console.log(myURL.search);
// Prints ?123

myURL.search = 'abc=xyz';
console.log(myURL.href);
// Prints https://example.org/abc?abc=xyz

Any invalid URL characters appearing in the value assigned the searchproperty will be percent-encoded. The selection of which characters to percent-encode may vary somewhat from what the parse and format methods would produce.

Type