Powered By GitBook
FLATTEN
Flatten a list of lists

Description

Takes a list of lists and returns a list with all the items from each of the original sub-lists.

Function signature

1
FLATTEN(lists: Array) => Array
Copied!
Parameter
Description
Lists
List of lists to flatten

Examples

1
numbersArr = [[1,2,3],[4,5,6],[7,8,9]]
2
stringsArr = [["Jack","Max","Rick"],["Kate","Jane"]]
3
objArr = [
4
[
5
{
6
"name": "Jack",
7
"age": 30
8
},
9
{
10
"name": "Rick",
11
"age": 35
12
}
13
],
14
[
15
{
16
"name": "Kate",
17
"age": 30
18
},
19
{
20
"name": "Jane",
21
"age": 32
22
}
23
]
24
]
Copied!
Formula
Return value
FLATTEN(numbersArr)
[1,2,3,4,5,6,7,8,9]
FLATTEN(stringsArr)
["Jack","Max","Rick","Kate","Jane"]
FLATTEN(objArr)
[{"name":"Jack","age":30},{"name":"Rick","age":35},{"name":"Kate","age":30},{"name":"Jane","age":32}]
Last modified 10mo ago
Export as PDF
Copy link