Objects Practice - SyntaxError: Expected ':'


#1

var object1 = {
game: "SSB",
opinion: "Amazing!"
};
var gameObj = new Object()
gamObj.game = "LOZ"

var object2 = {
anime: "Shiki",
favourite character: "The Doctor"
};

var object3 = {
favourite artist: "Botan",
media: "pencil"
};

Not sure where I went wring here, it keeps giving me this message:
SyntaxError: Expected ':'
I'm pretty sure I don't need another one


#2

Do something about the spaces here. It is reading this wrong :stuck_out_tongue:


#3

I did that thanks :grin:

however I now have a different problem:
ReferenceError: 'gamObj' is undefined

I have defined it here so whats the problem:
var gameObj = new Object()
gamObj.game = "LOZ"


#4

Put semicolons at the end of each line and you misspelled gameObj as gamObj.


#5

it still gives the same message
with an additional:
Oops, try again. Did you make object2 an object?


#6

Could you post your updated code please?


#7

var object1 = {
game: "SSB",
opinion: "Amazing!"
};
var gameObj = new Object();
gamObj.game = "LOZ";

var object2 = {
anime: "Shiki",
favouriteCharacter: "The Doctor"
};

var object3 = {
favouriteArtist: "Botan",
media: "pencil"
};


#8

I don't see any problems other than;

var gameObj = new Object();
gamObj.game = "LOZ"; //misspelled gameObj here

#9

THANKS SO MUCH, REALLY APPRECIATE IT :joy::grin::laughing:


#10

No problem :slight_smile:


#11

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