Q:

Trouble understanding JS functions in objects

I'm learning JavaScript and right now I'm working putting functions in objects.  I keep getting an evaluation error on the juggle function.  Could someone explain what I'm doing wrong?  Thank you!
var juggler = {
  itemCount: 0
  juggle: function () {
    this.itemCount += 1;
    var fate = parseInt(Math.random() * 10);
    if (this.itemCount > 2 && fate % 2 === 0) {
      this.drop();
      return 1;
    }
    else {
      return 0;
    }
  }
  drop: function () {
    console.log('ah!');
     this.itemCount = this.itemCount - 1;
  }
};

juggler.juggle();
juggler.juggle();
console.log('Juggler should be juggling two items:', juggler.itemCount);

var dropCount = 0;

dropCount += juggler.juggle();
dropCount += juggler.juggle();
dropCount += juggler.juggle();

console.log('Total number of items should be 5:', juggler.itemCount + dropCount);
console.log('Juggler should be juggling at least two items:', juggler.itemCount);

A:

Properties on an object must be separated by commas.
var juggler = {
  itemCount: 0,
// -----------^
  juggle: function () {
    // code here
  },
// ^
  drop: function () {
    // code here
  }
// note no comma on last item
};

A:

In Javascript {} signifies an object.  So you are creating an item named juggler with the properties itemCount, juggle, drop, etc.  As such, you need to separate these properties with commas:
itemCount: 0,
juggle: function () {

You can think of it (the syntax) like a map in Java, if that helps.

