Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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
You can’t perform that action at this time.