6. We made a new friend, syntax?



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


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


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