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_arrayand assign it the values[[1, 2, 3], [4, 5], [6, 7, 8, 9]].
Flatten the Array:
Create a new variable named
flattened_arrayand use a filter to combine all the elements from the sub-arrays innested_arrayinto 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