Question: My code looks similarly to this:

I create variable:

```
var person1;

```

Than I add this to array:

```
var people = [];
people.push(person1);

```

And finally I define what "person1" is:

```
person1 = new Person("Mike", 25, "London");

```

The problem is, people that are defined after pushing to array are undefined. For some reasons I can't define all people before putting to array. As I see, "people.push(person1);" actually puts copy of this variable to array. It is possible to do, that I put only reference of variable to the array?

Answer: 
You have to create an instance of an object and push the object pointer onto the array. Right now the problem is that you are pushing `undefined` since you do not instantiate a `Person` object first.
explicitly your code current looks like this:

```
var person1 = undefined;
var people = [];
people.push(person1);//pushing undefined unto the array
person1 = new Person();//now you have a pointer to an object

```

You have to first instantiate a `Person` then both your variable and array entry will point to the same thing

```
var person1 = new Person(); 
var people = [];
people.push(person1);//pushing a person reference onto the array
person1.someProperty = "lorem" 
people[0].someProperty = "ipsum"
//both person1.someProperty and people[0].someProperty are "ipsum"

```

Similarly you can instantiate the `person` directly in the array and create a variable referencing a object in the array.

```
var people = [new Person()]; //creates an array with a new person object.
people.push(new Person); //adds a new person to the array
var person1 = people[0];
var person2 = people[1];
person1.greet(person2);

```
first of all, you need to define `people` as an array `var people = []` 

then push to array a default person`new person()`for example, and then refer to person by index `people[1]` (for example), and then change that... to what you want