Skip to main content
URL.prototype.search - node__url.d.ts - Node documentation
property URL.prototype.search

Usage in Deno

```typescript import { URL } from "node:node__url.d.ts"; ```
Gets and sets the serialized query portion of the URL. ```js 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 `search` property will be `percent-encoded`. The selection of which characters to percent-encode may vary somewhat from what the [parse](../.././node__url.d.ts/~/parse) and [format](../.././node__url.d.ts/~/format) methods would produce.

Type