> For AI agents: the complete documentation index is available at https://massaman.dev/llms.txt, the full documentation bundle is available at https://massaman.dev/llms-full.txt.

# zipObject es-toolkit

Creates a single object from a keys array and a values array.

```typescript
const object = zipObject(keys, values);
```

## Usage

### `zipObject(keys, values)`

Use `zipObject` when you want to combine two arrays into a single object. It returns a new object where elements from the first array become keys and elements from the second array become values.

```typescript
import { zipObject } from 'es-toolkit/array';

// Create an object from keys and values.
zipObject(['a', 'b', 'c'], [1, 2, 3]);
// Returns: { a: 1, b: 2, c: 3 }

// If there are more keys, undefined becomes the value.
zipObject(['a', 'b', 'c', 'd'], [1, 2, 3]);
// Returns: { a: 1, b: 2, c: 3, d: undefined }
```

If the values array is longer, excess values are ignored.

```typescript
import { zipObject } from 'es-toolkit/array';

zipObject(['a', 'b'], [1, 2, 3, 4]);
// Returns: { a: 1, b: 2 }
```

#### Parameters


keysreadonly P[]required

The array that will become the object's keys.


valuesreadonly V[]required

The array of values corresponding to each key.

#### Returns

Returns a new object with keys and values combined.

```typescript
Record<P, V>
```


Source: es-toolkit

Re-exported verbatim from [`es-toolkit`](https://es-toolkit.dev/reference/array/zipObject.html). Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.
