Bill is not defined


#1
i honestly don't get objects at all now, i've been going at it for hours going back and forth through the lessons including arrays, but it never works lol
can anybody just tell me what i'm doing wrong with the keys?

var friends = new Object(); //main object
        friends.bill = new Object(); //subobject
            bill.firstName = 'bill'; //keys
            bill.lastName = 'gates';
            bill.number = '(206) 555-5555';
        friends.steve = new Object(); //subobject
            steve.firstName = 'steve'; //keys
            steve.lastName = 'jobs';
            steve.number = '(112) 101-1010';

#2

Explain what it is you're trying to make happen and what's happening instead. No idea what we are looking for otherwise.

And though your code is intact, please mark it as pre-formatted text for any and all code so that there is no doubt about this.


#3

i'm trying to create objects inside of my friends object, but i think there's an issue with how i'm going about inputting the properties, since i'm constantly getting 'bill is not defined' also done pre-formatting! i had no idea i could do that


#4

You added an attribute to friends. That attribute doesn't end up in global namespace, it only exists in the friends object.

Check out the example code in the first exercise. There they set friends.bill to a new object that has some attributes name and address and that stuff. That is, they create the whole object, and assign it to friends.bill in one go


#5

i thiiink i got it this time, thanks for the help again!
i did manage to complete the exercise eventually, though a proper explanation as to why this wasn't working in particular definitely did help.