12. Practice makes perfect


#1

what is wrong with my code?

var object1 = {
name: value,
purpose: value,
};

var object1 = {};
object1.name = "object1";
object1.purpose = "nothing";

var object2 = {
name: value,
purpose: value,
};

var object2 = {};
object2.name = "object2";
object2.purpose = "nothing";

var object3 = {
name: value,
purpose: value,
};

var object3 = {}
object3.name = "object3";
object3.purpose = "nothing";


#2

I don't know?

What is wrong?

Do you get a syntax error or does the lesson not pass you?

Does your computer randomly burst into flames?


#3

When creating an object, commas are only placed at the end of the line if there will be more lines coming after it. So, in the case of object1, the purpose line should not have a comma at the end of it.


#4

That is incorrect. Comma's aren't required at the end, but can be there.


#5

I just tested it, and if there is a comma on the last line, it shows syntax error. If I remove the comma, there is no error.