Difficulty: 6/10array flattening, recursion, depth handlingThe flat(depth) method of Array instances creates a new array with all sub-array elements concatenated into it recursively up to the specified depth.javascriptCopyScenario Questions0-2 years experience1How would you write a simple version of Array.flat that only flattens one level?2If you call your polyfill with depth 0, what should it return and why?3What edge case do you need to consider when the input array is empty?Follow-up QuestionsWhat is the time and space complexity of your implementation?How does your polyfill handle sparse arrays or holes?Can you explain how you would detect native support and conditionally apply the polyfill?Suggest Improvement