Why the comma after the braces?


#1

add: function(itemCost){
this.total += itemCost;
},--------------------------------Pls why the [comma] after the braces..

it wasn't needed in the exercise before it.
Just wish to understand..


3. Short Term Memory
#2

Because the method is a member of the cashRegister object.

var my_object = {
    prop1: "value1",
    prop2: "value2"
}

That last property key-value pair does not get a comma, but all the rest before it do.

var myObject = {
    method1: function () {

    },
    method2: function () {

    }
}

var friends = {
    bob: {

    },
    mary: {

    }
};

#3

Thank You for Clearing that out


#4

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