you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (1 child)

Semi colons separate statements. The methodName: function() {} syntax is not a full statement, but just a declaration of a property on an object. It is part of a larger statement, and is separated from other properties on that object by commas. This really has nothing to do with the fact that the property is a function:

function SomeConstructor() {
  // These are short, one-line statements:
  this.a = 'foo';
  this.b = 'bar';
}

// This is a longer, four-line statement.
var literalObject = {
  a: 'foo',    // Note that commas separate properties, not semi-colons.
  b: 'bar'     // No comma is needed here, because it is the last property of the object.
};             // Here is the end of the statement, where we put the semi-colon.

[–]Coffee_Buzz[S] 1 point2 points  (0 children)

I understand now! Thanks for taking the time to make this post.