I have no clue what to do with this lesson, ca someone help me?


#1



var friends = new Object(); 

//Adding friends to the "friends" object
friends.bill = new Object();
friends.juliett = new Object();
friends.steve = new Object();
    
var friends = {
    bill:{
        firstname: "Bill",
        lastname:"Gates",
        number:"8138138138"
    }
};
var friends = {
    juliett:{
        firstname: "Juliett",
        lastname:"Gates",
        number:"8138138138"
    }
};
var friends = {
    steve:{
        firstname: "Steve",
        lastname:"Gates",
        number:"8138138138"
    }
};


#2

HI you should post your code and the error you get?


#3

Please click on the little pencil icon in the bottom right hand corner of your post, then paste your code in between the three backticks.


#4

Hey there, Joshua,

Which lesson is this? If it's "Tossing in an array" you may be missing addresses...

Also, it looks like you may be declaring each friend as well as your contact list multiple times, effectively creating them multiple times, I think. If I put this between each of your var friends = { ... blocks:

console.log("my friends now:");
for (var person in friends) {
    console.log(friends[person]);
}

it prints a different "friends" list (containing one friend each) every time.


Since you didn't say, we don't know what you're having trouble with, but if you find this lesson confusing in general, might I suggest you jump ahead to "An Introduction to Objects I"? If you don't feel like starting from lesson 1, I recommend you focus on lessons 6-12. (No need to move past 12 yet.)

Like you, I found the "Contact List" lesson very confusing especially from around this point. The lessons I mentioned (6-12) review the basics of creating objects, and while they come after this chapter, as I did them I thought it would have been helpful for me to go through them before doing this lesson.


Another general tip: May I recommend you check out JavaScript & JQuery by Jon Duckett? I just borrowed this book from the library on recommendation of javascriptissexy (which in turn is recommended on reddit, etc). and about ~150 pages in so far I have found the book very well organized and that it helps to better internalize the JS syntax; it seems designed in a way that's suitable for review as well.

For example: