Paytm interview question

Array and Ovject flatten code. Not to use ES6 features