6. List 'em all! - Invalid shorthand property initializer. Please help!


#1


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

Below is the code I am using for part 6 "List 'em all!" of the contact list exercise. I am getting the following error but can't figure out where I've gone wrong?

SyntaxError: Invalid shorthand property initializer


var friends = {};
friends.steve = {
    firstName = 'Steve',
    lastName = 'Jobs',
    number = '075490683888',
    address = ['Two Apple Road','Appletown','Applecity','USA']
};
friends.bill = {
    firstName = 'Bill',
    lastName = 'Gates',
    number = '075494949586',
    address = ['One Microsoft Road','Microtown','Microcity','UK']
};

var list = function(obj) {
    for(var prop in obj)
    {
        console.log(prop);
    }
};


#2

You are using Object literal notation, so should be:

friends.steve = {
    firstName: 'Steve',
    ...
};

Don't forget to call function list() to see results.


#3

Thank you for the reply! Sorry but I don't understand the difference between

and


#4

colon vs equal sign


#5

holy balls of course!! Thanks a lot guys :relaxed:


#9