May you please help debug my program


#1


var friends = {
friends.steve = {
    firstName: "Steve",
    lastName: "Job",
    number: "",
    address:[]};
friends.bill = {
    firstName: "Bill",
    lastName: "Gates",
    number:"(206) 555-5555",
    address: ['One Microsoft Way', 'Redmond', 'WA", "98052'],
};


Thank You


#2

Can you include a link to the lesson as well as an error message? I know one thing that is wrong is that you don't close friends.bill anywhere with a closing curly brace, }, and you also have a comma on the last line,

which makes it expect something.


#3

Include an address and phoneNumber here,

friends.bill = {
    firstName: "Bill",
    lastName: "Gates",
    number: "(206) 555-5555", //Example
    address: ["By the Window","Redmond", "WA", "557ty"] //Example

    };
friends.steve = {
    firstName: "Steve",
    lastName: "Jobs",
    number: "(609) 666-7777",
    address: ["Your local Apple tree","Los Angeles", "CA","6g3q6"]

    };

#4

SyntaxError: missing : after property id
https://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/5?curriculum_id=506324b3a7dffd00020bf661


#6

Follow your advice. Thank You, but I still have a problem.
https://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/5?curriculum_id=506324b3a7dffd00020bf661
SyntaxError: missing : after property id
var friends = {
friends.steve = {
firstName: "Steve",
lastName: "Job",
number: "5",
address:[1,1]};
friends.bill = {
firstName: "Bill",
lastName: "Gates",
number:"(206) 555-5555",
address: ['One Microsoft Way', 'Redmond', 'WA", "98052']};
};


#7

Because I don't know what i did wrong, so I included to see if someone else notices it. Thankyou.


#9

I never give any code without an explanation r without pointing out where the user went wrong and how he/she can fix it,

If you look closely all of his code coorelates with the one I posted all I added was an address and number which was his error. :grin:

Mine,

friends.bill = {
    firstName: "Bill",
    lastName: "Gates",
    number: "(206) 555-5555", //Example
    address: ["By the Window","Redmond", "WA", "557ty"] //Example

    };
friends.steve = {
    firstName: "Steve",
    lastName: "Jobs",
    number: "(609) 666-7777",
    address: ["Your local Apple tree","Los Angeles", "CA","6g3q6"]

    };

His,

friends.steve = {
    firstName: "Steve",
    lastName: "Job",
    number: "",
    address:[]};
friends.bill = {
    firstName: "Bill",
    lastName: "Gates",
    number:"(206) 555-5555",
    address: ['One Microsoft Way', 'Redmond', 'WA", "98052'],
}; //The only difference is the order and that his has no number and address

I myself strongly disagree with just "giving" code because it would beat the purpose of this forum don't you think? :smirk:

Please analyze the code carefully before making any accusations :laughing:


#10

Because you use dot notation in

and

you don't need it to be inside of var friends. What you should do is on the first line, just declare var friends = {}; so that you can use the dot notation correctly. :slight_smile:


#11

Sorry, I didn't mean to say that you weren't helping. You are right, it does correlate, I just was wondering. You definitely are right about just giving code without an explanation defeating the purpose, but sorry for bugging you haha. I do like you and I see you around the forums I was just asking a question. I'm pretty bad about nagging people about things, but I know that I include code sometimes too to get the point across and help relate to them. :smiley: No hard feelings dude! :slight_smile:
I definitely don't think I know everything about programming because I haven't been doing it long, I just didn't look at your code closely, but i know you're helping for the right reasons. I just should've looked closely. Sorry for the drama, I try not to start it. :slight_smile:


#12

Haha don't be sorry constructive criticism is quite healthy from time to time because now I know to give more detail in my explanations so that I don't seem like I'm giving too much code. :smile:
I see you around a lot too and it's pretty cool how you joined recently but have such an eager spirit to help others. Programming is way too big and constantly growing for even I to know everything about it. :laughing: No hard feelings at all! No worries, and happy coding. :slight_smile:


#13

Thank you I fix it, but I still am having trouble.
var friends = {}
steve: {
firstName: "Steve",
lastName: "Job",
number: "e",
address:[1]};
bill: {
firstName: "Bill",
lastName: "Gates",
number:"(206) 555-5555",
address: ['One Microsoft Way', 'Redmond', 'WA", "98052']}


#14

Pay attention to how the bill object's number and address is written.

you wrote your first one like this,


#15

Thank you, but my code still won't work, and it is telling me I am missing a space.
SyntaxError: missing before statement
var friends = {};
steve: {
firstName: "Steve",
lastName: "Job",
number: "e",
address:[1]};
bill: {
firstName: "Bill",
lastName: "Gates",
number:("206) 555-5555",
address: ['One Microsoft Way', 'Redmond', 'WA", "98052']};


#16

You have made no changes to your code even after I have pointed out your errors please read my reply and edit your code first. :grin: Or would you like me to explain again?


#17

May you please explain again.


#18

Sure, you need to write a valid number and address and not just,

but something like,

number:"(206) 555-5555",
address: ['One Microsoft Way', 'Redmond', 'WA", "98052']

#19

Thank You
I updated my code but it is saying that I am missing a ] after my element list. I can not find where I am missing a ].
var friends = {
steve: {
firstName: "Steve",
lastName: "Job",
number: "(206)5555-5555",
address:['One Microsoft Waay', 'Redmond', 'Wa' '98052']
};
bill: {
firstName: "Bill",
lastName: "Gates",
number:"(206) 555-5555",
address: ['One Microsoft Way', 'Redmond', 'WA", "98052']
};
};


#20

@fenrirthenorselupus, you have syntax errors:

var friends = {
   steve: {
      firstName: "Steve",
      lastName: "Job",
      number: "(206)5555-5555",
      address:['One Microsoft Waay', 'Redmond', 'Wa' * '98052'] // * - here you missed ,
   }; // should be , after property steve
   bill: {
      firstName: "Bill",
      lastName: "Gates",
      number:"(206) 555-5555",
      address: ['One Microsoft Way', 'Redmond', 'WA", "98052']
   }; // should be without ;
};

So, after properties you used ; but you need to use , , because steve and bill are properties of object friends. Also problem was in steve property: address:['One Microsoft Waay', 'Redmond', 'Wa' , (missed comma) '98052']


#21

Thank You, It really help.


#22

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