# FLAT

**The function FLAT takes a list of lists and returns a new list with the items contained in each sub-list.**

This function takes a [List](../../variable-data-types/the-list-data-type) containing items of any type and returns a new list by "flattening" any nested lists into the resulting list. For each item in the list that is a list itself, each item in the sub-list will be added to the final list. Any items that are not of the list type are passed along into the final list.

#### Declaration

```javascript
FLAT(collection) -> flattened_list
```

#### Parameters

**input\_list** (type: _list_) Any list of items.

#### Return Values

**flattened\_list** (type: _list_) A list created by unwrapping any nested sub-lists into the final list.

#### Examples

The most common way to use the FLAT function is to produce a single-level list from a list of lists.

```javascript
FLAT([[1, 2], [3, 4], [5, 6]]) -> [1, 2, 3, 4, 5, 6]
```

If there are items in the **input\_list** that are not lists themselves, they will appear un-modified in the final list.

```javascript
FLAT([1, 2, [3, 4], 5, 6]) -> [1, 2, 3, 4, 5, 6]
```

The FLAT function only removes a single level of nesting, when provided a list of lists of lists, the result will be a list of lists.

```javascript
FLAT([[[1, 2], [3, 4]], [[5, 6]]]) -> [[1, 2], [3, 4], [5, 6]]
```
