Search for a friend


var friends = {
bill: {
firstName: "Bill",
lastName: "Gates",
number: 123456789,
address: ['Washington str.', 2]
steve: {
firstName: "Steve",
lastName: "Jobs",
number: 234567891,
address: ['Texas str.', 50]
liepa: {
firstName: "Liepa",
lastName: "Malavickaite",
number: 345678912,
address: ['Jeruzales str.', 90]

var list = function (friends) {
for (var names in friends) {
console.log (names);

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

Its says:

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

Please HELP!



var search = function (friends)

why do you have friends as parameter? Make the parameter name, given you supply the name you want to search for

If you need more help, post an updated version of your code


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