Array with Gameobjects code

I’ve been trying to solve this thing for about an hour now, could somebody tell me why this error:

NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args)
UnityScript.Lang.UnityRuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args, System.Type scriptBaseType)
GUI [ Manager].Update () (at Assets/GUI [ Manager].js:15)

is happening with this code? :

var timer: float = 300; // set duration time in seconds in the Inspector
var cube: GameObject;
var cubeArray;
function Start() {
	var cubeArray = new Array();
function Update(){
  timer -= Time.deltaTime;
  if (timer < 0){
     timer = 5;
     cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
     cube.transform.position = Vector3 (0, 30, 0);
     cubeArray.Add( cube );
       for (var i = 0; i < cubeArray.Length; i++)  { 

} else {
guiText.text = timer.ToString(“F1”);
“Cube” is a script, if anyone is wondering.

Don’t use the Array class. Always use built-in arrays or generic Lists instead. The only things Array has by comparison are casting problems, slower code, and fewer features. So forget it exists. Also never do things like var cubeArray;. You must always define the type, either explicitly, or implicitly by supplying a value.