How To Conditionally Select Array Or Array Of Objects In Javascript

How To Conditionally Select Array Or Array Of Objects In Javascript