Problem with variables

So I’m writing a program and have run into a problem with variables.

var someArray : array;
var someVar : CustomClass;

function Update()
{
   var tempVar = someVar;
   someArray.Push(tempVar);
   //call a function which resets someVar
}

What I want is for ‘tempVar’ to be put into the array with the values that ‘someVar’ has during that particular moment. But after I put it into the array it keeps updating itself to whatever the current value of ‘someVar’ is. How do I make this do what I want it to?

This is a matter of pointers (I think pointers are used in javascript right ?). Anyway, you need to do a copy of someVar at this moment. A copy constructor is usually a good way to do that.