/
Flatten an Array of Arrays
Flatten an Array of Arrays
You can use reduce()
and append()
to flatten and array of arrays.
Here’s an example:
a = [[1,2,3],[4,5,6],[7,8,9]];
b = a.reduce(function(a,b){a.append(b)},[])
// b -> [1,2,3,4,5,6,7,8,9]
, multiple selections available,
Related content
Array Operators
Array Operators
More like this
Looping using the reduce operator
Looping using the reduce operator
More like this
Set Operators
Set Operators
More like this
Decoding WWW-Form Encoded Content or Query Parameters
Decoding WWW-Form Encoded Content or Query Parameters
More like this
Map Operators
Map Operators
More like this
Copyright Picolabs | Licensed under Creative Commons.