6 List'em all! Help


#1

var friends = {
bill: {
firstName: "Bill",
lastName: "gates",
number: "(151) 555 5555",
address:["29 Micosoft road","Redmond","WA","12345"]
},
steve: {
firstName: "Steve",
lastName: "jobs",
number: "(555) 505 1234 ",
address:["23 Apple road","Beachhill","CA","54321"]
}
};

var list = function (friends) {
for (var friend in friends);
console.log(friends);
};

Hello all I've been stuck and clueless on what to do here when i click sea and submit the error i get is this "It looks like your list function isn't printing the right output"

but console.log prints this
{ bill:
{ firstName: 'Bill',
lastName: 'gates',
number: '(151) 555 5555',
address: [ '29 Micosoft road', 'Redmond', 'WA', '12345' ] },
steve:
{ firstName: 'Steve',
lastName: 'jobs',
number: '(555) 505 1234 ',
address: [ '23 Apple road', 'Beachhill', 'CA', '54321' ] } }

Any help would be much appreciated :slightly_smiling: thanks!


#2

Hi i instead of friends put friend


#3

You console.log has incorrect argument. You've given an object 'var friend' in the function so it should be console.log(friend);


#4

Hello Thanks for the reply's but when i put in friend instead of friends i still get the "it looks like your list function isn't printing the right output." and then the console prints just Steve


#5

please some one help me,i have stucked here
i dont know exactly what should i do

var friends = {};
friends.bill = {
firstName:'Bill',
lastName:'sates',
number:0912,
address:['One apple way','kuprino','WA','98052']};
friends.steve = {
firstName:'Steve',
lastName:'gates',
number:0939,
address:['One Microsoft Way','Redmond']};
var list = function(friends) {
for(var firstName in friends) {
console.log(friends)

}
};
list();

#6

var list = function(friends){
for(var firstName in friends){
console.log(firstName);
}


#7

thanks dude,that was great


#8

Hello, can someone help me, i do not understand what's wrong?
tell me this "syntax error ':' ?

var friends = {
bill: {
firstName: "Bill",
lastName: "Gates",
number: "(206) 555-5555",
address: ['One Microsoft Way'],
},
steve: {
firstName: "Steve",
lastName: "Jobs",
number:"(456) 456-7589",
address: ["Silicon valley"],
},
mandela: {
firstName:"Nelson",
lastName: "Mandela",
number: "skycompany!",
address: ["Dans son cercueil"],
},
flipper: {
firstName:"flipper",
lastName:"le dauphin",
number:"vingt mille lieux sous les mers",
address: ["Sous la mer"],
},
mickey: {
firstName:"Mickey",
lastName:"Mouse",
number:"Walt Disney",
address: ["Au palais de Minnie"],
},
var list = function(friends) {
for(var bill in friends) {
console.log(bill);
}
};


#9

when you finish with mickey here:
address: ["Au palais de Minnie"],
},

you have to close var friends ={

so: after of }, put: };

like this:
mickey: {
firstName:"Mickey",
lastName:"Mouse",
number:"Walt Disney",
address: ["Au palais de Minnie"],
},
}; (this you have to write)

it works! :slightly_smiling:


#10

thanks , it works but now i call the function but he say "Oops, try again. Did you create a function called list? "

};
var list = function (friends) {
for(var bill in friends) {
console.log(bill);
}
};
list(friends);