7.Search for a friend


#1

So this is my code for this part

var friends = {
bill: {
firstName: "Bill",
lastName: "Thorton",
number: "(765) 869-7654",
address: ['42 East Redwood St', 'Charming','CA','99017']
},
steve: {
firstName: "Steve",
lastName: "Johnson",
number: "(765) 246-8435",
address: ['64 Clarence St','Charming','CA','99017']
}
};
var list=function(friends) {
for (var friends in friends) {
console.log(friends);
}
};
var search=function(name) {
for (var friends in friends) {
if(friends[bill].firstName==="Bill") {
console.log(friends[number]);
return friends[number];
}
}
};

it says it doesn't return contact information for steve, I know I'm doing something wrong I've tried various methods to include steve but nothing is working. Could someone please help me out with this?


#2

Hey @gigacoder67794! Its just a simple funny fix! You actually didnt call the function.

So at the end just include

search(steve);

#3

Hey man, I tried that and it didn't work. (it said steve isn't defined) Got any other ideas?


#4

Try searching for the string maybe ?

search("Steve");


#5

I had the same problem. I think the keys Steve and Bill need to be capitalized.