7. search for friends


#1

Her is my code:
var friends = {
bill: {
firstName: "Bill",
lastName: "Gates",
number: "(206) 555-5555",
address: ['One Microsoft Way','Redmond','WA','98052']
},
steve: {
fistName: "Steve",
lastName: "Jobs",
number: "(408) 666 6666",
address: ['panama ave','Long Beach','CA','40051']
}
};
var list = function(friends) {
for (var i in friends) {
console.log(key);
};
};
var search = function(name) {
for(var key in friends) {
if(friends[key].firstName === name) {
console.log(friends[key]);
return friends[key];
}
}
};
search("Steve")

I don't think I am understanding something here. I have looked at a bunch of other posts and am not seeing what I am doing wrong and what is missing. I just continually get Bill's information, { firstName: 'Bill',
lastName: 'Gates',
number: '(206) 555-5555',
address: [ 'One Microsoft Way', 'Redmond', 'WA', '98052' ] }, when submitting the code.


#2

@chipsolver23726,

Have a close look at

fistName


#3

aww geeze!! hahah can't believe that.

Thanks. It lets me go on but it outputs this now..
{ firstName: 'Steve',
lastName: 'Jobs',
number: '(408) 666 6666',
address: [ 'panama ave', 'Long Beach', 'CA', '40051' ] }
{ firstName: 'Steve',
lastName: 'Jobs',
number: '(408) 666 6666',
address: [ 'panama ave', 'Long Beach', 'CA', '40051' ] }
{ firstName: 'Steve',
lastName: 'Jobs',
number: '(408) 666 6666',
address: [ 'panama ave', 'Long Beach', 'CA', '40051' ] }
{ firstName: 'Bill',
lastName: 'Gates',
number: '(206) 555-5555',
address: [ 'One Microsoft Way', 'Redmond', 'WA', '98052' ] }
{"firstName":"Steve","lastName":"Jobs","number":"(408) 666 6666","address":["panama ave","Long Beach","CA","40051"]}

I am assuming that isn't right.


#4

@chipsolver23726,
Add an extra code line at the End-of-your-code

 console.log( "==This is my End==" );

You will see that you have an extra output =AFTER= your code is excuted
as the course-checker will do it's Display as well