Identify the problem


Can you tell me what's wrong here?

The error message:

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

My code:

var friends = {};
friends.tovy = {
    firstName: 'Ron',
    lastName: 'Tovy',
    number: '(999) 345-6789',
    address: ['My best friend', 'Another thing that tells pesonal informasion about him', 'MuHaHaHa']
friends.bill = {
    firstName: 'Bill',
    lastName: 'Gates',
    number: '(206) 555-5555',
    address: ['One Microsoft Way','Redmond','WA','98052']
friends.steve = {
    firstName: 'Steve',
    lastName: 'Shir',
    number: '(111) 123-2123',
    address: ["Do you like my new shoes?", "Honey, you are a chair.", "I can dream, Merold!"]
var list = function(obj) {
    for (var key in obj) {
var search = function(name) {
    for(var key in friends) {
        if (name === key.firstName) {
            return key;

Thanks, Ron Dankner


You have wrong syntax. To get access to nested object property you need to use:


Function returns contact information, so it's should be an object: friends[key].

In your case key are names of nested objects: tovy, bill, steve. But it are not objects.


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