Contact list wrong output


#1

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

the code only puts out 'steve' to the console and shows "Oops, try again. It looks like your list function isn't printing the right output." as the error message. any advice?

Here is the code:

var friends = {
    bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: "(206) 555-5555",
        address: ['One Microsoft Way','Redmond','WA','98052']
    },

    steve: {
        firstName: "Steve",
        lastName: "Jobs",
        number: "(206) 666-5555",
        address: ['Twenty-Two Apple Ave','Mactown','CA','87635']
    }
};

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

#2

Your loop has no statements in it


#3

What would be the correct code/syntax for the for/in loop? I am not sure how to correct the mistake...


#4

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in


#5

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