6/8 trouble


#1

I've tried multiple things to satisfy what the lesson asks for but I just can't figure it out. My code looks like this:

var friends = new Object(); {
    var friends = {
        bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: "(707) 555-5555",
        address: ['One Microsoft Way','Redmond','WA','98052']
        }
    };
    var friends = {
        steve: {
        firstName: "Steve",
        lastName: "Jobs",
        number: "(707) 555-5566",
        address: ['90210','Hollywood','CA','95688']
        }
    };
};

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

Any pointers would be great!


#2

I'd suggest going back to 3/8 Adding your friends and setting up the following code:

var friends = {};

friends.bill = {};

friends.steve = {};

You'll find that initializing the objects that way is cleaner and easier.

Also, you're missing a semicolon after you console.log and the parameter that your function takes doesn't match what's in the body of your for loop (either change the parameter to object or change object to friends in your for loop.

Check out jshint.com for help on syntax issues - it's very easy to use. Good luck!


#3

A minor fix (keeping your basic structure intact)

var friends = {
    bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: "(707) 555-5555",
        address: ['One Microsoft Way','Redmond','WA','98052']
    }.
    steve: {
        firstName: "Steve",
        lastName: "Jobs",
        number: "(707) 555-5566",
        address: ['90210','Hollywood','CA','95688']
    }
};

#4

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

I'm a beginner too... but it looks like you need to change the word object in that function to the name of the object you're referencing. So object should be friends. Hope that helps!


#5

friends should be object to keep the function generic and re-usable by other objects.