11/17 Creating your own objects


#1

Im on the last lesson, im typing in this code:
var myOwnObject = new Object();

myOwnObject.age: 19;
myOwnObject.name : "Andrew";

and i keep getting the same mistake "SyntaxError: missing before statement"

I tried everything, please help.


#2

Take a closer look at like 2 & 3. It's the colon. :smiley:


#3

Fixed that, still the same error :smile:


#4

Wait so you're code' s this now

var myOwnObject = new Object();

myOwnObject.age = 19;
myOwnObject.name = "Andrew";

and it's saying it's incorrect? :confused:


#5

Pushed the Save & Submit button the second time, worked fine, thanks :slightly_smiling:


#6

var myOwnObject = new Object();

myOwnObject.age = 19;
myOwnObject.name = "Samagan";

console.log("Hi Samagan");


#7

If thats a problem @saslynch12 im prety sure its here where your encountering your problem...

That above was static, not dynamic.. so its better of to change it to dynamic:

console.log("Hi " + myOwnObject.name);