Pregunta de entrevista de Boomi

coding question in JS: write a function to flatten a nested array