I want to create a new instance of an object every time I click a button on my page. The problem is the reference variable, if you look at this example?
<input value="Create person" onclick="CreateObject()" />
......
function CreateObject(){
var person = new Person("Carl", 18);
}
Everytime the function is called an instance of the object is created, with the same reference variable. I want the reference variables to be different every time the function is called (eg. "person1", "person2", "person3"). What shall I do?