"We Made a Friend!" Syntax Question


#1


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


So I'm not really having issues with the code, but I don't understand why this code works. This is the example code that the lesson provides, but based on what I see, this shouldn't output the correct logs. Since we define "firstName","lastName", etc., shouldn't the output be something like:

add("Dec","Ness","decness@ex.com","(555) 555-5555")

/*output:
Dec: Dec
Ness: Ness
decness@ex.com: decness@ex.com
(555) 555-5555: (555) 555-5555


//example code provided

contacts[contacts.length] = {
    firstName: firstName,
    lastName: lastName,
    phoneNumber: phoneNumber,
    email: email
};


so why wouldn't that happen?


#2

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