Contact list whats wrong


#1

var friends=new Object();

friends.bill = new Object();

friends.steve = new Object();
friends.max = new Object();
friends.mika = new Object();
friends.hannes = new Object();
friends.antonio =new Object();

var friends = {
bill:{
firstName: "Bill",
lastName:"Donaldsson",
number:"1234577434",
address:["blbl","02389","Köping"]
}
};

var friends ={ steve : {
firstName: "Steve",
lastname:"Neave",
number:"43598349582",
address:["tranebo","45656","Kumla"]
}
};
var friends={ max: {
firstName: "Max",
lastName: "Svensson",
number: "8098",
address: ["Skogsvägen", "9999","Åsele"]
},

mika :{
    firstName: "Mika",
    lastName: "Tuominen",
    number: "69798468",
    address:["rantatie","01210","Helsinki"]
},
antonio: {
    firstName:"Antonio",
    lastName: "Sanches",
    number: "08768768746747474674",
    address:["Fredrikinkatu","01010101","Helsinki"]
}

};

var list=function() {
for (var sak in friends) {
console.log(sak);
}
};
var search=function(name) {
for (var sakr in friends) {
if (friends[sakr].firstName ===name) {
console.log(friends[sakr]);
return friends[sakr];
}
}

};

I simply dont get it.What is wrong with my code? I get:"youre code doesnt return contact information for steve


#2

Hi try to call your function search() with the name of steve.