Where wrong?


#1

please help

var friends = {};
friends.bill = {
firstName: "Bill",
lastName: "Gates",
number: "(062) 555 555",
address: ["f","f","f","f"]
};
friends.visnja = {
firstName: "Visnja",
lastName: "Suv",
number: "(064) 555 555",
address: ["d","d","d","d"]
};
friends.steve = {
firstName: "Steve",
lastName: "Jobs",
number: "(062) 444 444",
address: ["e","e","e","e"]
};
var search = function (name){
for (var x in friends) {
if (friends[x].firstName === name) {
console.log(friends[x]);
}
}
};

search("Steve");

Oops, try again. It looks like your search function doesn't return contact information for Steve.

link : https://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/7?curriculum_id=506324b3a7dffd00020bf661#


#2

you need to log and return friends[x]


#3

thanks u i forget to add else


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.