6. We made a new friend, syntax?


#1


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

Whats his issue? I dont want to name this object, I just declared its properties and assigned it to the array index. Can he not do this? I tried several variations...

var add = function(fN, lN, mail, pN) {
  
  contacts[contacts.length] = new Object(firstName, lastName, email, phoneNumber);
contacts[contacts.length].firstName = fN;
contacts[contacts.length].lastName = lN;
contacts[contacts.length].email = mail;
contacts[contacts.length].phoneNumber = pN;
};

add("Bruce", "Benner", "benner@mail", "00033434");


#2

Do not place contacts.length as the initials of each property, rather let it serve as the object's name which will be equal to the properties.

Then call the function with the values and lastly, call list()


#3

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