Can anyone tell me what I did wrong?


#1



var bob = {
    firstName: "Bob",
    lastName: "Jones",
    phoneNumber: "(650) 777-7777",
    email: "bob.jones@example.com"
};

var mary = {
    firstName: "Mary",
    lastName: "Johnson",
    phoneNumber: "(650) 888-8888",
    email: "mary.johnson@example.com"
};

var contacts = [bob, mary];

function printPerson(person) {
    console.log(person.firstName + " " + person.lastName);
}
function list() {
    contactsLength = contacts.length;
    for ( var i = 0; i < contractLength; i++) { 
        printPerson(contacts[i]);
    };
};
list();


#2

@sylaryan,

Have a close look at

contractLength


#3

I think I did it right...


#4

no, you didn't. You declare the variable contactsLength here:

contactsLength = contacts.length;

which then you are planning to use in the for loop, but there you use contractLength, take a close look, they are two different words

contract and contacts are two very different things


#5

thank you soooo much!!


#6

thank you!!!! I have solved it


#7

thank @leonhard.wettengmx.n, he was the person who saw the mistake