Contact List - Adding Properties


#1

Heyyyyyy,

Can't seem to figure out what I'm doing wrong. Here's my code:

Thanks in advance.


#2

Hey,

For bill and Steve you shouldn't add var


#3

Inside your friends var, "steve" and "bill" should not be variables. Also, put a comma after the second curly bracket on bill, and delete the semicolons after steve and bill. Example:

var friends = {
    bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: "(801) 123-4567"
    },
    steve: {
        firstName: "Steve",
        lastName: "Jobs",
        number: "(999) 479-7799"
    }
}

#4

@travmoffat87 Also make sure you separate Bill and Steve with a comma, not semicolon. Delete those semicolons.


#5

I tried taking out "var" in front of bill and steve, and closing the bracket at the beginning, and now it's telling me I don't have first names for bill or steve.


#6

Bill and Steve needs to be inside friends so between { }


#7

Doing that gives me SyntaxError: Unexpected token


#8

Can you paste in updated code

Like @quobogeba said:


#9

Thanks quobogeba and zainabrawat. Here's the updated code:


#10

You have bill = {} same with Steve
You need to use a colon bill: {}

*Leave friends


#11

Perfect, thanks!


#12

@travmoffat87 bill and steve should not be assigned to their firstName, lastName ect, with an =. Instead, you should assign them with a colon, like so:

bill: {
  bills code goes here
}

Just like @zainabrawat said :slightly_smiling:

Oops! Looks like I was too late xD


#13

haha well thanks anyhow :slightly_smiling:


#14

@quobogeba lol

@travmoffat87 You're welcome :green_heart:

Happy Learning :slightly_smiling:
Happy coding !

What inspired you to learn programming/coding?
Join the discussion