Please help! It looks like your search function doesn't return contact information for Steve


#1

I keep getting the error message that my search function doesn't return information for steve. Please help! Everything worked fine until I tried to add the last function; the one in the code block.

var friends = new Object();
friends.bill = new Object();
friends.steve = new Object();

friends.bill.firstName = "bill";
friends.bill.lastName = "nobody";
friends.bill.number = "12123";
friends.bill.address = ['2901', 'nowhere dr.', 'nowhere, tx', '70000'];
friends.steve.firstName = "steve";
friends.steve.lastName = "nobody";
friends.steve.number = "12156";
friends.steve.address = ['2901', 'nowhere dr.', 'nowhere, tx', '70000'];

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

> function search(name) {
>     for (var key in friends) {
>         if(friends[key].firstName === name) {
>             console.log(friends[key]);
>             return friends[key];
>         }
>     }
> }

list();
search("steve");

Thank you


#2

@cloudcoder48792,
If you see an Oops-message it is of great help if you give the EXACT message,
as the message probably displayed "Steve"....

In the Instructions, you were explicitly asked you to use the
firstName's "Steve" and "Bill".

The course checker is depending on those exact firstName's.