
Working with nested data structures often requires flattening. Let's build a function that handles any depth!
flatten(array, depth) functiondepth levelsdepth = 1 flattens one level, depth = Infinity flattens completelyArray.flat() for comparisonSubmit your code to see test results