Advertisement
Guest User

Untitled

a guest
Jul 11th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  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];
  16.  
  17. function printPerson(person) {
  18. console.log(person.firstName + " " + person.lastName);
  19. }
  20.  
  21. function list() {
  22. var contactsLength = contacts.length;
  23. for (var i = 0; i < contactsLength; i++) {
  24. printPerson(contacts[i]);
  25. }
  26. }
  27.  
  28. list();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement