Skip to content

Instantly share code, notes, and snippets.

@stevencombs
Created September 25, 2013 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencombs/6706133 to your computer and use it in GitHub Desktop.
Save stevencombs/6706133 to your computer and use it in GitHub Desktop.
// 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