Displaying People!


i know it sound weird but i don't know why i can't use console.log to print out instead of using printPerson??
thank you.

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

 // console.log(contacts[0])


This was the test of using
defining a function with parameter
calling a function with an argument
accessing an object using the so-called dot-notation...


i mean normally i just use console.log to print out what i want to print out. but in this case i have to use the command printPerson(contacts[0]); to print out the contacts . why can't i use console.log?


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