How does this code works? I have a basic idea but would like to confirm it


#1



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


#3

Hi you built a function add that add a new contacts with the argument firstName,lastName,phoneNumber,email then inside it you create an object that will be the at the last index of the array contacts contacts[contacts.length] with the propriety firstName,lastName,... then as value you set the argument of the function add

var object {
   propriety: value,
}