Pergunta de entrevista da empresa Sense

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