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


#1

var friends = {};

friends.bill = {
    firstName: 'Bill',
    lastName: 'Gets',
    number: 1,
    address: ['One Microsoft Way','Redmond','WA','98052']
    };
    
friends.steve = {
    firstName: 'Stevt',
    lastName: 'Jobs',
    number: 2,
    address: ['One Apple Way','Redmond','WA','98052']    
    };

var list=function(o){
    for(var k in o){
        console.log(k);
    }      
};
   
var search = function(name){
     for (var x in friends) {
        if( friends[x].firstName === name ){
            console.log(friends[x]);
       }
        else {
            console.log("No Found!");
        }
    }
 };
 
list(friends);
search("Steve");

#2

if your friend is found, you only log the information to the console:

console.log(friends[x]);

you should also return the information, from the instructions:

it should log that friend's contact information to the console and return it.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.