RenewBuy interview question

flatten an array in javascript