7.Search for friend


Dear friends,

Please help me to resolve my code
var friends = {};
friends.bill = {
firstName: "Duglas",
lastName: "Costa",
number: "(095) 212-32576",
address: ['st. Shevchenko','Riasne','UA','360/20']
friends.steve = {
firstName: "Andriy",
lastName: "Shevchenko",
number: "(093) 973-2148",
address: ['Shevchenka','Riasne','UA','45/40']
var list = function() {
for ( i in friends) {
var search = function(name) {
for (var key in friends.steve) {
if (friends[key].firstName === name) {
console.log (friends[key]);
return friends [key];

The problem is "Did you create the function called search?"
But I have the answer


the aim is to search through your friends list not just steve's



I have tried to do it twice but nothing special happen maybe do you something else on your thought


are the credentials for steve what was originally given in module?


Here is my solution (I used the other method to create the objects):

var friends = new Object();

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

friends.bill.firstName = "Bill";
friends.bill.lastName = "Gates";
friends.bill.number = "(620) 640-0001";
friends.bill.address = ["st city st"];

friends.steve.firstName = "Steve";
friends.steve.lastName = "Jobs";
friends.steve.number = "(620) 640-0002";
friends.steve.address = ["st city st"];

var list = function(friends) {
for(var firstName in friends) {

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


Hello Spkoehn,

Could you please explain your method,
Please provide a few comments from your side,

I have to admit how good your code is


Again your code is not wrong.The reaon you are no passing is because the credentials(details) for the steve and bill property(object) are not what was originally given in the course. That is what the tester expects


Ok, thank you for your little help in my case,
have a wonderful day ahead


Copy Pasting your solution prints out in console 3 times the profile of steve lets say, so is not quite the right solution. Thx anway