4/6 I get an ReferenceError


#1

here is my code:

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);
}

var list = function(){
var contactsLength = contacts.length;
for(var i; i < conteactsLength; i++){
printPerson(contacts[i]);
}
};


#2

See anything strange in the above?


#3

I saw the mistakes in my typing but now do i get syntax error
Here is my code now:

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);
}

var list = function(){
var contacts Length = contacts.length;
for(var i; i < contactsLength; i++){
printPerson(contacts[i]);
}
};


#4

There is white space in the variable name. Remove the space and things should work out.


#5

Thanks it worked for me