Help on 6/8


#1

var friends = {
bill: {firstName: "Bill",
lastName: "Gates",
number:2345167,
address: ['One Microsoft Way','Redmond','WA','98052']},
steve: {firstName: "Steve",
lastName: "Jobs",
number: 7263263,
address: ['apple','Redmond','WA','98052']}
};
var list = function(friends)
{
for(var x in friends){
{ console.log(friends[x][firstName]);

}

}
I dont understand what's wrong with this code. Like I'm using variable 'x' to access bill and steve and then friends[x][firstName] to access their respective "firstName". But still it shows "unexpected end of output".


#2

You're missing one more closing bracket }
It's a good idea to learn what error codes are referring to. Syntax errors usually mean you are confusing the browser trying to read your code according to a relatively strict guideline.

Unexpected end of input is one example of wrong syntax.


#3

var list = function(friends) {
for (var friends in friends) {
console.log(friends);
}
}
...this code is working