Is there a way to delete multiple game objects?

Hi,(I’m half asleep at the moment so I apologise in advance if my code is incorrect)

I’m having problems deleting multiple objects. The Destroy function doesn’t seem to take GameObjects[ ] so I was wondering if anyone knows an alternative to this. My snippet of code so far

var myTriggers : GameObjects[];

function Update() {
      myTriggers = GameObject.FindGameObjectsWithTag("triggers");
      Destroy(myTriggers);
}

-Hakimo

Here’s the code in C# (Sorry, I don’t speak Javascript)

GameObjects[] myTriggers = GameObjects.FindGameObjectsWithTag("triggers");
foreach (GameObject trigger in myTriggers){
    Destroy(trigger);
}

The theory is essentially this: Loop through each GameObject in the array and destroy them one by one. If Javascript doesn’t have foreach, it surely would have “while” loops, which you can use to achieve similar things.

Thanks BobC. I’ll put it to the test in a bit.
-Hakimo