Array to spawn enemies

Hello ladies and gentlemen.

I have been struggling with a slight problem in regards to my javascript

I am currently trying to simply create an array of 3 objects (or 3 different enemies)
and have them spawn randomly from the same spawn point but the answer to said problem seems to be eluding me, please forgive my incompetence.

#pragma strict

var HazardArray : GameObject[];
var spawnLocation : Transform;

function Start () {

}

function Spawnpoint() 
{
var enemies : int = HazardArray.length;
Instantiate(enemies[HazardArray], spawnLocation.position, Quaternion.identity);
}

Thankyou in advance for an assistance you can offer on the matter

Kind regards

I guess what you are looking for is when you call Spawnpoint() function you want one of the enemeies from your array to spawn at the spawnLocation.

If this is what you want you can change your Spawnpoint() function to:

function Spawnpoint() 
{
    Instantiate(HazardArray[Mathf.Random(0, HazardArray.Length)], spawnLocation.position, Quaternion.identity);
}