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


#1


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



// 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


#2

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)


#3

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


#4

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


#5

This link might help explain it if you forgot:


#6

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