---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# URLSearchParams.forEach()

The **`forEach()`** method of the
`URLSearchParams` interface allows iteration through all values contained
in this object via a callback function.

## Syntax

```js
forEach(callback)
forEach(callback, thisArg)
```

### Parameters

- `callback`

  - : Function to execute on each element, which is passed the following arguments:

    - `value`
      - : The value of the current entry being processed in the `URLSearchParams` object.
    - `key`
      - : The key of the current entry being processed in the `URLSearchParams` object.
    - `searchParams`
      - : The `URLSearchParams` object the `forEach()` was called upon.

- `thisArg` _**optional**_
  - : Value to use as `this` when executing `callback`.

### Return value

None `undefined`.

