where will the return put the friend[i]?
where will the return put the friend[i]?
where will the return put the friend[i]?
var friends = {
steve: {
firstName: "Steve",
lastName: "Jobs",
number: "(831)524-2213",
address: ["531 Recht St.","Hollister","CA","95037"]
},
bill: {
firstName: "Bill",
lastName: "Gates",
number: "(831)524-0349",
address: ["310 E Dunne Ave", "Morgan Hill", "CA","95037"]
}
};
var search = function(name){
for (var i=0;i<friends;i++){
if (friends[i].firstName === name) {
console.log(friends[i]);
return friends[i];
}
}
};