Advertisement
Guest User

lol

a guest
Sep 4th, 2015
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var bob = {
  2.     firstName: "Bob",
  3.     lastName: "Jones",
  4.     phoneNumber: "(650) 777-7777",
  5.     email: "bob.jones@example.com"
  6. };
  7.  
  8. var mary = {
  9.     firstName: "Mary",
  10.     lastName: "Johnson",
  11.     phoneNumber: "(650) 888-8888",
  12.     email: "mary.johnson@example.com"
  13. };
  14.  
  15. var contacts = [bob, mary, ilya];
  16.  
  17.  
  18. function printPerson(person) {
  19.     console.log(person.firstName + " " + person.lastName);
  20. }
  21.  
  22. function list() {
  23.    
  24.     for (var i = 0; i < contacts.length; i++) {
  25.         printPerson(contacts[i]);
  26.     }
  27. }
  28.  
  29. var add = function (firstName, lastName, phoneNumber, email) {
  30.     contacts[contacts.length] = {
  31.     firstName: firstName,
  32.     lastName: lastName,
  33.     phoneNumber: phoneNumber,
  34.     email: email
  35.        
  36.        
  37.         }
  38.     }
  39.  
  40. add("ilya","vlasov","467427","inestacs@gmail.com");
  41. list();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement