27. Loop The Loop


#1

https://www.codecademy.com/en/courses/spencer-sandbox/4/2?curriculum_id=506324b3a7dffd00020bf661


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

{"name":"timmy","age":6}

// Our Person constructor
var Person = function(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 i=0;i > family.length; i++){
     console.log(family[i].name);
};

For some reason I can't get to the name property of the Person object
Thanks to whoever answers this!:smiley:


#2

HI in the for loop

for(var i=0;i > family.length; i++)

this part

i > family.length

i will never be great than family.length so you should put <


#3

Yea, wismarco got it! just switch your greater than/less than around. Thanks, i couldn't get this one either.


#4

Thanks That Really Helped!