11. Putting it all together - can't understand what's wrong


#1


SyntaxError: Invalid shorthand property initializer


// help us make snoopy using literal notation
// Remember snoopy is a "beagle" and is 10 years old.
var snoopy = {
    species = "beagle",
    age = 10
};

// help make buddy using constructor notation
// buddy is a "golden retriever" and is 5 years old
var buddy = new Object();
    buddy.species = "golden retriever";
    buddy.age = 5;


#2

[user]@murator[/user]

To create an Object,

you can use the literal notation,
you directly create an Instance of the object, with the
properties being separated by a comma-,

var myObj = {

    type: 'fancy',
    disposition: 'sunny'

};

or

You create an Object by the construct notation.

myObj = new Object(); or myObj = {};

  myObj.type = 'fancy';
  myObj.disposition = 'sunny';

thank you


#3

Thanks, yes comma is a decision, do not let yourself take lessons after 10 pm ))


#4

you are welcome!
bye-bye.


#5

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