3.Displaying people


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
var printPerson = function(person) {
console.log(person.firstName + " " + person.lastName);


what's wrong with this code?


Please rephrase in terms of what you want it to do and what it does instead.


Oops, try again. It looks like your function didn't log "Bob Jones" to the console. Did you remember to call your function on bob?

this is what i get


Okay. It says you didn't print something. Did you?


Don't know if I lost you or you're buried in your code, so I'll just leave this:

My point is that errors contain information about what happened that you can verify and follow up on.

It's not just "wrong" and it's also not just not printing. Keep digging. Until you can't any more, and then ask for help about the specific part where you are really stuck, if that happens at all.

If it says something wasn't printed, then you'll need to consider why it would have been printed and then compare that to what's happening in your code.

So, you'd start somewhere in the middle of that action and find out if everything is as it should be at that point of time, and then you'll be able to tell which half of the action you'll need to look at next. Repeat until mistake is found.

To find out what's being done, print out what it is doing.


It' s wrong

It's correct


You do not need the console.log part when calling it. since the function contains the console.log, simply just use