At loss - build an address book


#1


Building an address book - 2


I'm getting - "Oops, try again. Make sure that mary is the second object in contacts"
Why is that? I'm sure I'm missing something out here


var contacts = [bob, mary];
var bob = {
    firstName: "Bob",
    lastName: "Jones",
    phoneNumber: "(650) 777-7777",
    email: "bob.jones@example.com"
};

var mary = {
    firstName: "Mary",
    lastName: "Johnson",
    phoneNumber: "(650) 888 - 8888",
    email: "mary.johnson@example.com"   
}
console.log(contacts[1].phoneNumber);


#2

code runs from top to bottom, you can't store objects which are defined yet into a array, move the array to after the objects declaration

Fascinating, defining the array first, then create the objects seems to be possible, but the checking script doesn't like it. Still, to pass the exercise move the array to after the object declaration


#3

Hey thanks, I was about to take a break and have some snacks


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.