Cant seem to get the search contacts to display Steve' s details correctly


#1

Hi I am stuck on Searching contact list can anyone take a look at my code and point me in the right direction please ?The lesson get passed, but i don't understand why Steve's details show up 3 times

my code is:

var friends = 
    { 
            bill:
        {
            firstName:"Bill",
            lastName:"Gates",
            number:"123",
            address:["60 Treadneedle street,London,UK"] 
        },
            steve:
        {
            firstName:"Steve",
            lastName:"Jobs",
            number:"456",
            address:["130 Wood street, London,UK"]
        }
    };
    var list = function(friends)
        {
            for(var i in friends)
            console.log(i);
        };
    var search = function(name)
    {
        for(var i in friends)
        {
        
            if(friends[i].firstName === name)
            {
                console.log(friends[i]);
                return friends[i];
            }
            
        }
        
    };
    list(friends);
    
    search("Steve");

**my results are below:

bill
steve
{ firstName: 'Steve',
lastName: 'Jobs',
number: '456',
address: [ '130 Wood street, London,UK' ] }
{ firstName: 'Steve',
lastName: 'Jobs',
number: '456',
address: [ '130 Wood street, London,UK' ] }
{ firstName: 'Steve',
lastName: 'Jobs',
number: '456',
address: [ '130 Wood street, London,UK' ] }
{ firstName: 'Bill',
lastName: 'Gates',
number: '123',
address: [ '60 Treadneedle street,London,UK' ] }
{"firstName":"Steve","lastName":"Jobs","number":"456","address":["130 Wood street, London,UK"]}