Code works, but something I confused about


#1

Code works, but something I confused about.

This is my code:
// Our Person constructor
function Person (name, age) {
this.name = name;
this.age = age;
};

// Now we can make an array of people
var family = new Array();
family [0] = new Person("alice", 40);
family [1] = new Person("bob", 42);
family [2] = new Person("michelle", 8);
family [3] = new Person("timmy", 6);

// loop through our new array
for (var count = 0; count < family.length; count++) {
console.log(family[count].name);
};

--- Ouput:---
alice
bob
michelle
timmy


We're running a test below to make sure your code works.
alicebobmichelletimmy

Could someone explain it to me. Thanks in advanced.


#2

Are you confused about the output?

We're running a test below to make sure your code works.
alicebobmichelletimmy

Then you don't need to worry about it as it is system generated (and not by your code).


#3

Thank you :smile: now I can move to the next exercise.