SHARE
TWEET

Untitled

a guest Aug 13th, 2017 118 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];
  16.  
  17. function printPerson(person) {
  18.     console.log(person.firstName + " " + person.lastName);
  19. }
  20.  
  21. function list() {
  22.     var contactsLength = contacts.length;
  23.    
  24.     for (i = 0; i<contactsLength; i++) {
  25.         printPerson(contacts[i]);
  26.         }
  27.     }
RAW Paste Data
Top