6. We made a friend


#1

can't figure out what's wrong here, tried to check other posts for answer but still no working.

function add(firstName, lastName, email, phoneNumber){
contact[contacts.length] ={
firstName: firstName,
lastName: lastName,
email: email,
phoneNumber: phoneNumber
};
};

add("Joan", "Steven", "(333) - 546773", "j_st@thatmail.com");
list();


#2

@dr.takoyaki,

Have a close look at

contact


#3

Thank you for your assistance :wink: realy need to start to pay attencion to these details.


#4

This happened to work for me (after hours of troubleshooting)! Hope this helps you... :slightly_smiling:

var add = function(firstName, lastName, email, phoneNumber) { //create function as asked
contacts[contacts.length] = { //create a new object, use its future index as a name (last position of the array)
firstName: firstName, // assign parameters to properties
lastName: lastName,
email: email,
phoneNumber: phoneNumber
}
};

add("John", "Smith", "johnsmith@zmail.com", "555-555-5555"); //call add function, pass new contact info
list(contacts); //check, as they request, to see if your new friend made the list!