The list function vs the printPerson function


#1


I am just curious why the printPerson function is created without var prefacing it while the list function does have it:

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


https://www.codecademy.com/courses/building-an-address-book/0/4?curriculum_id=506324b3a7dffd00020bf661#


Replace this line with your code.


#2

Hi you can create a function like that...

var functionName = function(arg) {
  #do something
}

or 

function functionName(arg) {
    #do something
}

it's the same just the structure that's different


#3

Thanks so much for the answer. I wasn't sure if I was missing something. I was examining another help post and the functions were written different ways but ran fine. Have a great day!