Code works strangely


#1

Here is my code:

var friends={};
friends.bill={};
   friends.bill.firstName='Bill';
   friends.bill.lastName='Muray';
    friends.bill.number='568956';
    friends.bill.address=['ulica','adres','dsa456']
friends.steve={};
    friends.steve.firstName='Steve';
    friends.steve.lastName='Jobs';
    friends.steve.number='556545';
    friends.steve.address=['ulica2','adrescz','dsa456'];
    var list=function(dane){
    for(n in friends){
        console.log(n)
        }
    };
var search=function(name){
    for(var k in friends){
        if(friends[k].firstName===name){
            console.log(friends[k]);
            return friends[k];
            }
            else{
                console.log("doesnt found")
                }
        }
    };
 search("Steve")

Why console print doesnt found/steve/ doesnt found/steve/ doesnt found/steve/**bill**?
Name match to friends object so why it prints so many things including else(doesnt found) and bill?

doesnt found
{ firstName: 'Steve',
lastName: 'Jobs',
number: '556545',
address: [ 'ulica2', 'adrescz', 'dsa456' ] }
doesnt found
{ firstName: 'Steve',
lastName: 'Jobs',
number: '556545',
address: [ 'ulica2', 'adrescz', 'dsa456' ] }
doesnt found
{ firstName: 'Steve',
lastName: 'Jobs',
number: '556545',
address: [ 'ulica2', 'adrescz', 'dsa456' ] }
{ firstName: 'Bill',
lastName: 'Muray',
number: '568956',
address: [ 'ulica', 'adres', 'dsa456' ] }
{"firstName":"Steve","lastName":"Jobs","number":"556545","address":["ulica2","adrescz","dsa456"]}


#2

@devcoder96779,
If you are searching "Steve" in your friends object
you will get 1 doesnt found
for "Bill" which doesn't match "Steve".

Please use

search("Steve");
console.log( "== My End ==" );
console.log( "== All that is displayed now, is the course-checker ==" );