Objective: Create a multi-dimensional array and flatten it into a single-dimensional array.
Instructions:
Define the Multi-Dimensional Array:
Create an array variable named
nested_array
and assign it the values[[1, 2, 3], [4, 5], [6, 7, 8, 9]]
.
Flatten the Array:
Create a new variable named
flattened_array
and use a filter to combine all the elements from the sub-arrays innested_array
into a single, flat array.
Submit the array contained in the variable
flattened_array
.
Expected Result:
Submit the variable flattened_array
as your answer. See example below:
Install the snippet to get started: https://www.xano.com/snippet/XwN5GThx