Sense interview question

Q: Give me a function that behaves like 'flat' function in JavaScript.