Contact list, 4. Adding properties


#1



https://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/4?curriculum_id=506324b3a7dffd00020bf661#


The error message says, "It looks like your friends don't have the firstName property." Thanks for the help.


var friends= new Object();
    friends.bill= new Object(); {
        Object.firstName= "Bill";
        Object.lastName= "Gates";
        Object.number= "(309) 555-5555";
}
     friends.steve= new Object(); {
        Object.firsName= "Steve";
        Object.lastName= "Jobs";
        Object.number= "(308) 444-4444";
}


#2

The problem is that you aren't suppose to use dot notation; your writing the object in curly braces right? (the the name for the type of object escapes me right now). So what you should do is say firstName: "something" and do that with the rest of your code as well. Don't use the = sign in this type of object constructor, remember to use the colon instead. Also, don't say new Object, because you aren't using dot notation, instead just say,

var something = {
something: {

},

somethingElse: {

}
}

#3

You are using both the notations together. Use one of them.
Either
var friends=new Object();
friends.bill=new object();
friends.bill.firstName="Bill";
so on

Or
var friends={
bill:{
firstName:"Bill"
}
}


#4

Thank you, javaninja03847.


#5

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