Tossing in an Array


#1

Hi,

I'm having trouble with the excercise 'Tossing in an Array'. I have looked and looked but I can't seem to find the problem. I get the error - "Unexpected Indentifier".

Here is the code:

var friends = {
winny: {
number: "0425141823",
address: ["21 go ■■■■ yourself lane","Adelaide"]
}
bill: {
firstName: "Bill",
lastName: "Clinton",
number: "0400110011",
address: ['2 Devonshire Road,','Hawthorndene','Adelaide'],
}
steve: {
firstName: "Steve",
lastName: "Jobs",
number: "0411001100",
address: ['11 Tallarrook Road','Hawthorndene','Adelaide']
}

}


#2

please excuse my language haha


#3

Take a look at object steve:

steve: {
  firstName: "Steve",
  lastName: "Jobs",
  number: "0411001100",
  address: ['11 Tallarrook Road', 'Hawthorndene', 'Adelaide']
}

All property: value pairs are separated using commas.

But friends is also an object, but I don't see any commas there :slight_smile:


#4

sorry, i dont get what you mean? I already have commas in the address line?


#5

Ok, let us assume for a second that winny, bill and steve are empty objects:

var friends = {
  winny: {} // <-- missing comma
  bill: {} // <-- missing comma
  steve: {}
};

You need to separate these properties using commas. Just like in the steve object.


#6

Great, thanks heaps! Just an easy overlook by me


#7

You're very welcome :slight_smile:


#8

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