7.Search for a friend--output question


Hi, Sorry this isn't formatted but it's too long to screen cap.
I'm just trying to understand why this is printing out extra information after my search function.
Here's my code:
(I'm printing "======" dividers to tell what's doing what in the results, and wrote the output in the comments. My question is in the last line: why does the code return two extra copies of Steve's info and an extra copy of Bill's info? Where in my code is this coming from?)

var friends = new Object();
friends.bill = new Object();
friends.bill.firstName = "Bill";
friends.bill.lastName = "Gates";
friends.bill.number = "555-1999";
friends.bill.address = ['One Microsoft Way', 'Redmond', 'WA', '98052'];

friends.steve = new Object();
friends.steve.firstName = "Steve";
friends.steve.lastName = "Jobs";
friends.steve.number = "555-2007";
friends.steve.address = ['1 Infinite Loop', 'Cupertino', 'CA', '61801']

console.log(friends) //prints bill and steve info
console.log(friends.bill) //prints bill info
console.log(friends.bill.address) //prints bill's address info

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

list(friends) //prints "bill" and "steve" on separate lines


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

search("Steve"); //prints steve info


search("Bill"); //prints bill info


//My code ends here, and I expected the output to end here also. But after this it prints Steve's info, Steve's info again, and then Bill's info. My question is why does it print this extra info??



It is the course-checker,
doing its tests.