Spawn game objects on a timer

I have this script that spawns enemies, but they only spawn once. So what I was wondering is if there is a way to add a timer or something into this script to make it so they will keep spawing. Here is the script.

#pragma strict
 // Instantiates a prefab in a grid
 
 var prefab : GameObject;
 var gridX = 5;
 var gridY = 5;
 var spacing = 2.0;
 
 function Start () {
     for (var y = 0; y < gridY; y++) {
         for (var x=0;x<gridX;x++) {
             var pos = Vector3 (x, 0, y) * spacing;
             Instantiate(prefab, pos, Quaternion.identity);
         }
     }
 }

use InvokeRepeating , this will create every 2 seconds

 function Start () {
     float startIn=1;
     float every=2;
     InvokeRepeating("spawn", startIn, every);
  }

spawn(){
      for (var y = 0; y < gridY; y++) {
          for (var x=0;x<gridX;x++) {
              var pos = Vector3 (x, 0, y) * spacing;
              Instantiate(prefab, pos, Quaternion.identity);
          }
       }
    }

var timer:float;

function Update(){

if (timer<0){Instantiate bad guys here; 
              timer=10;}


timer=timer-Time.deltaTime;
}

that should do it!