Flatten an Array
Turn [[1, 2], [3], [4, 5]] into [1, 2, 3, 4, 5]. reduce + concat
merges each sub-array into an accumulator.
Your task
Write flatten(arr) that flattens an array of arrays by one level.
β‘ 35 XP
solution.jsRuns in your browser
Loading editorβ¦
Tests3 to pass
basic
with empties
empty
Run your code to check these.