title: TypeError: xxx is not a function
body: <p>This question has been answered before, but I'm a javascript beginner and am struggling to apply other peoples solutions to my problem. I apologize in advance!</p>
  
  <p>I'm following the Beginning Javascript 5th edition book and in the Objects chapter, it's making me build a Cinema booking system. I keep getting a TypeError: xxx is not a function, but I can't seem to figure out why. The code seems to be fine (it clearly isnt.. :)). The error appears as I'm initializing 'bookings' in a new array, using the Cinema() constructor. <strong>Error is on line 53</strong>.</p>
  
  <p>Would love some help, the book isn't very helpful. I've checked it line by line. </p>
  
  <p>Thanks!</p>
  
  <pre><code>//CustomerBooking type
  
  function CustomerBooking (bookingID, customerName, film, showDate) {
  this.customerName = customerName;
  this.bookingID = bookingID;
  this.film = film;
  this.showDate = showDate;
  }
  
  CustomerBooking.prototype.getCustomerName = function () {
  return this.customerName;
  }
  
  CustomerBooking.prototype.setCustomerName = function (customerName) {
  this.customerName = customerName;
  }
  
  CustomerBooking.prototype.getShowDate = function () {
  return this.showDate;
  }
  
  CustomerBooking.prototype.setShowDate = function (showDate) {
  this.showDate = showDate;
  }
  
  CustomerBooking.prototype.getFilm = function () {
  return this.getFilm;
  }
  
  CustomerBooking.prototype.setFilm = function (film) {
  this.film = film;
  }
  
  CustomerBooking.prototype.getbookingID = function () {
  return this.bookingID;
  }
  
  CustomerBooking.prototype.setbookingID = function (bookingID) {
  this.bookingID = bookingID;
  }
  
  // Cinema Type
  
  function Cinema() {
  this.bookings = new Array();
  }
  
  Cinema.prototype.addBooking = function (bookingID, customerName, film, showDate) {
  this.bookings(bookingID) = new CustomerBooking(bookingsID, customerName, film, showDate);
  }
  
  Cinema.prototype.getBookingsTable = function() {
  var booking;
  var bookingsTableHTML = "&lt;table border=1&gt;";
  
  for (booking in this.bookings)
  {
      bookingsTableHTML += "&lt;tr&gt;&lt;td&gt;";
      bookingsTableHTML += this.bookings(booking).getBookingID();
      bookingsTableHTML += "&lt;/td&gt;";
  
      bookingsTableHTML += "&lt;td&gt;";
      bookingsTableHTML += this.bookings(booking).getCustomerName();
      bookingsTableHTML += "&lt;/td&gt;";
  
      bookingsTableHTML += "&lt;td&gt;";
      bookingsTableHTML += this.bookings(booking).getFilm();
      bookingsTableHTML += "&lt;/td&gt;";
  
      bookingsTableHTML += "&lt;td&gt;";
      bookingsTableHTML += this.bookings(booking).getShowDate();
      bookingsTableHTML += "&lt;/td&gt;";
      bookingsTableHTML += "&lt;/tr&gt;";
  }
  
  bookingsTableHTML += "&lt;/table&gt;";
  return bookingsTableHTML;
  }
  
  var londonOdeon = new Cinema();
  londonOdeon.addBooking(401, "AJ", "Toy Story", "1 Jan 2015");
  londonOdeon.addBooking(402, "Michelle", "Silver Lining Playbook", "2 Jan 2015");
  londonOdeon.addBooking(403, "James", "Terminator", "3 Jan 2015");
  londonOdeon.addBooking(404, "Josh", "Balooons", "4 Jan 2015");
  
  document.write(londonOdeon.getBookingsTable());
  </code></pre>