Boomi interview question

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