flatMap([1, 2, 3], x => [x, x * 2]) // β [1, 2, 2, 4, 3, 6]flatMap<T, U> maps each element to an array then concatenates all results into one flat array.
Challenge: Implement flatMap<T, U>(arr: T[], fn: (x: T) => U[]): U[] mapping then flattening one level.
flatMap([1, 2, 3], x => [x, x * 2]) // β [1, 2, 2, 4, 3, 6]