6/8 It says I didn't create function called list


#1

It says that I didn't create a function called list. Here's my code:

    var friends = {
    friend1: "bill" = {
        firstName: "Bill";
        lastName: "Harrington";
        number: "(212) 777-7777";
        adress: ["300 Center St.", "Concord", "MA", "01742"];
    };
    friend2: "steve" = {
        firstName: "Steve";
        lastName: "Jobs";
        number: "(914) 914-9911";
        adress: ["2066 Crist Dr.", "Los Altos", "CA", "94022"];
    };
};
var list = function (friends) {
    for(var firstName in friends) {
        console.log(firstName);
    };
};

Here's the message codecademy says:

Oops, try again. Did you create a function called list?

This is what the console says:

ReferenceError: Invalid left-hand side in assignment

I clearly did create a function called list, and I don't know why it keeps saying that.
Please give feedback!


#2

The error message is one of a limited number in the SCT. It would indicate that the code did not run because a real exception was thrown, the ReferenceError.

We cannot write something like this:

friend1: "bill" = {}

There are two assignments, which is invalid syntax. The primary keys in the friends object are supposed to be, bill and steve:

var friends = {
    bill: {},
    steve: {}
};

#8

Thanks for helping me! You solved that problem but their was another problem because I didn't put a comma after each key in the objects.