Check out example codes for "destory all gameobjects in array unity". It will help you in understanding the concepts better.

Code Example 1

if(Inventory.Length > 0) {     foreach(GameObject go in Inventory)     {         Destroy(go);     } }   //OR   for(int i = 0; i < Inventory.Length; i++) {      Destroy(Inventory[i].gameObject); }

Learn ReactJs, React Native from akashmittal.com