RenewBuy Interview Question

flatten an array in javascript