---
title: URLSearchParams
summary: The URLSearchParams class as specified by WHATWG
url: https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/globals/class.URLSearchParams/
---

**Kind:** Class  
**Module:** [globals](https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/globals/)  
**Package:** @fastly/js-compute 4.0.1  
**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L830

The URLSearchParams class as [specified by WHATWG](https://url.spec.whatwg.org/#interface-urlsearchparams)

**See also**

- [URLSearchParams on MDN](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)

## Constructor

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L831

```javascript
new URLSearchParams(init?: ReadonlyArray<readonly [name: string, value: string]> | Iterable<readonly [name: string, value: string]> | { readonly [name: string]: string } | string)
```

**Parameters**

- `init`: `ReadonlyArray<readonly [name: string, value: string]> | Iterable<readonly [name: string, value: string]> | { readonly [name: string]: string } | string` (optional)

## Methods

### append

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L839

```javascript
append(name: string, value: string): void
```

**Parameters**

- `name`: `string`
- `value`: `string`

**Returns**

`void`

### delete

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L840

```javascript
delete(name: string): void
```

**Parameters**

- `name`: `string`

**Returns**

`void`

### entries

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L849

```javascript
entries(): IterableIterator<[string, string]>
```

**Returns**

`IterableIterator<[string, string]>`

### forEach

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L850

```javascript
forEach(callback: (this: THIS_ARG, value: string, name: string, searchParams: this) => void, thisArg?: THIS_ARG): void
```

**Parameters**

- `callback`: `(this: THIS_ARG, value: string, name: string, searchParams: this) => void`
- `thisArg`: `THIS_ARG` (optional)

**Returns**

`void`

### get

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L841

```javascript
get(name: string): string | null
```

**Parameters**

- `name`: `string`

**Returns**

`string | null`

### getAll

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L842

```javascript
getAll(name: string): Array<string>
```

**Parameters**

- `name`: `string`

**Returns**

`Array<string>`

### has

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L843

```javascript
has(name: string): boolean
```

**Parameters**

- `name`: `string`

**Returns**

`boolean`

### keys

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L847

```javascript
keys(): IterableIterator<string>
```

**Returns**

`IterableIterator<string>`

### set

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L844

```javascript
set(name: string, value: string): void
```

**Parameters**

- `name`: `string`
- `value`: `string`

**Returns**

`void`

### sort

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L845

```javascript
sort(): void
```

**Returns**

`void`

### values

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L848

```javascript
values(): IterableIterator<string>
```

**Returns**

`IterableIterator<string>`
