3. Displaying People: Having trouble, take a look at my code?



For the most part I've been able to get through the course by looking at the hints and other people's questions when I got stuck.. I have compared my code to other people's and I can't figure out what I did wrong. Can someone take a look at my code and see if they can figure it out?

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];

// printPerson added here
function printPerson (person) {
console.log(person.firstName + " " + person.lastName);
printPerson (contacts[0]);

printPerson (contacts[1]);

Any help would be much appreciated, thanks!



I tested your code and it worked for me. I noticed that sometimes code that looks okay gets error messages but if I open then close the lesson it works fine.


That worked, haha thanks!

var printPerson = function(person) {
    console.log(person.firstName + " " + person.lastName);