---
name: "up.Params.prototype.get"
area: "API"
kind: "Instance method"
parent: "up.Params class"
url: "https://unpoly.com/api/up.Params.prototype.get"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.Params class](https://unpoly.com/api/up.Params.md)</nav>

# up.Params.prototype.get(name)

Returns the first param value with the given `name`.

Returns `undefined` if no param value with that name is set.

If the `name` denotes an array field (e.g. `foo[]`), _all_ param values with the given `name` are returned as an array. If no param value with that array name is set, an empty array is returned.

To always return a single value, use [`up.Params#getFirst()`](https://unpoly.com/api/up.Params.prototype.getFirst.md) instead. To always return an array of values, use [`up.Params#getAll()`](https://unpoly.com/api/up.Params.prototype.getAll.md) instead.

## Example {#example}

```js
let params = new up.Params([
  { name: 'foo', value: 'fooValue' },
  { name: 'bar[]', value: 'barValue1' },
  { name: 'bar[]', value: 'barValue2' }
])

let foo = params.get('foo')
// foo is now 'fooValue'

let bar = params.get('bar[]')
// bar is now ['barValue1', 'barValue2']
```

---

## Parameters {#parameters}

### name {#name}

(required)

Type: string

