5.Tossing in an array


#1


I can't figure out what I did wrong will someone explain.


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


Oops, try again. There was a problem with your syntax.
SyntaxError: Unexpected identifier

var friends = {
    bill: {
    firstName: "Bill",
    lastName: "Gates",
    number: "(206) 555-5555"
    address: ['One Microsoft Way', 'Redmond', 'WA', '98052',]
    },
    steve: {
    firstName:"Steve",
    lastName:"Jobs",
    number: "(909) 765-7456"
   address: ['One Apple Way', 'Upland', 'CA', '91784',]
    }
 };


#2

You have to add a comma before the address property. Interpreter is simply surprised that there is something more.

And you can delete the last comma from the arrays.

var friends = {
    bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: "(206) 555-5555", // <-- added comma
        address: ['One Microsoft Way', 'Redmond', 'WA', '98052']
    },
    steve: {
        firstName: "Steve",
        lastName: "Jobs",
        number: "(909) 765-7456", // <-- added comma
        address: ['One Apple Way', 'Upland', 'CA', '91784']
    }
};

#3

anyone know why this won't work??

var friends = {
bill: {
firstName: "Bill",
lastName: "Gates",
number: "(576) 888-8888",
address: ['one microsoft way', 'richmond', 'va', '5359']
},
steve: {
firstName: "Steve",
lastName: "Gates",
number: "(878) 888-9989",
address: {'one apple butthole', 'watevs', 'ok', '8768']
}
};


#4

Problem is here:

address: {

this is an array so it should be:

address: [

#5

ahh, whoops. Thanks!


#6

You're very welcome! :slight_smile:


#7

var friends = {
bill: {
firstName: "Bill",
lastName: "Gates",
number: "(206) 555-5555",
address: ["one windows way", "murica"]
},
steve: {
firstName: "Steve",
lastName: "Jobs",
number: "(206) 123-5555",
address: ['69 apple road', 'silicon valley']
}
};

There's my working code, hope it helps.


#8

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