> For the complete documentation index, see [llms.txt](https://icheka-ozuru.gitbook.io/sonarlang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://icheka-ozuru.gitbook.io/sonarlang/syntax-basics/data-structures/maps/built-in-functions-for-manipulating-maps.md).

# Built-in Functions for Manipulating Maps

There are a few built-in functions available to you when working with maps.

### len()

**len()** returns the number of *key-value pairs* in a map. This value is always a number, and it is equal to the number of keys in the map.

```javascript
>> len({1: 2, "a": 3})
// outputs 2
```

### mapKeys()

**mapKeys()** returns all the keys of a map as elements of an array.

```javascript
>> let my_map = {"name": "Bella", "age": 10, "gender": "female"}
>> mapKeys(my_map)
// outputs ['name', 'age', 'gender']
```

The order of elements in the array returned by **mapKeys()** is not guaranteed to be constant.

### mapValues()

**mapValues()** returns all the values of a map as elements of an array.

```javascript
>> let my_map = {"name": "Bella", "age": 10, "gender": "female"}
>> mapValues(my_map)
// outputs ['Bella', 10, 'female']
```

Like **mapKeys()**, the order of elements in the array returned by **mapValues()** is not guaranteed to be constant.

### mapEntries()

**mapEntries()** returns an array whose elements are the key-value pairs of a map. Each element is represented as an array where the first element is the key and the second is the value of the pair. The returned array is a *2-dimensional array.*

```javascript
>> let my_map = {"name": "Bella", "age": 10, "gender": "female"}
>> mapEntries(my_map)
// outputs [['age', 10], ['gender', 'female'], ['name', 'Bella']]
```
