Salesforce interview question

Flatten a nested array in javascript