Created
September 25, 2013 21:14
-
-
Save stevencombs/6706133 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Javascript Getting Started with Programming | |
// A Codecademy Javascript (Displaying People) assignment | |
// Dr. Steven B. Combs, coding novice | |
// Create an address book from objects | |
// bob object | |
var bob = { | |
firstName: "Bob", | |
lastName: "Jones", | |
phoneNumber: "(650) 777-7777", | |
email: "bob.jones@example.com" | |
}; | |
// mary object | |
var mary = { | |
firstName: "Mary", | |
lastName: "Johnson", | |
phoneNumber: "(650) 888-8888", | |
email: "mary.johnson@example.com" | |
}; | |
// Array to contain the contacts (objects) | |
var contacts = [bob, mary]; | |
// Print Person Function | |
function printPerson(person) { | |
console.log(person.firstName + " " + person.lastName); | |
} | |
// Print the name of each contact individually | |
printPerson(contacts[0]); | |
printPerson(contacts[1]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment