17/17


#1

please help me. thank you.


#2

Javascript objects are commonly defined like this:

var myOwnObject = {
    name: "kelly",
    age: 26,
    dream: "designer"
}

#3

@levibarker thank you for your help. I tried your format ,it was good, but ":"should take place of "=".

you talk about literal syntax;

could you please help me how to write my code by object constructor?

thanks。


#4

Ahh oops I had some errors in my code thanks for catching that.

It looks like new object() should be changed to new Object() with the "O" capitalized.


#5

by object constructor it'll be:

var myOwnObject = new Object();
myOwnObject.name = "Alex";
myOwnObject.age = 19;
myOwnObject.sex = "male";

console.log(myOwnObject);

or you can also use: "myOwnObject['name'] = 'Alex';"