How do you write the for loop "for" this lesson?


// Our Person constructor
function Person (name, age) { = 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


you can use a normal for loop, here is a syntax refresher:

for (var i = 0; i < 20; i++)

if you don't remember, revisit loop exercises (or documentation like MDN)


ok thanks I needed a syntax refresher but I couldn't find anything in the lesson about it


for loop has been taught, so the exercise assumes: you know, your revisit earlier exercise or visit external documentation (MDN for example)


This link might help explain it if you forgot:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.