title: Error :Uncaught TypeError: Object function
body: <p>When I write <code>book.main.method();</code> I got error <strong>:Uncaught TypeError: Object function () {</strong></p>
  
  <pre><code>window.book = window.book|| {};
  
      book.control = function() {
          var check_is_ready = 'check_is_ready';
          if(check_is_ready == 'check_is_ready') {
              this.startbook = function() {
                  var bookMain = new book.main();
                      bookMain.method();
              return;
              };
          };
      };
  
  $(function() {
      var control = new book.control();
      control.startbook();
  });
  
  (function () {
      book.main = function() {     
      var index =0;
          this.method = function() {
              index++;
              if (index &lt;= 500){
                  book.main.method();//  &lt;-- this wrong
                  // the error which I get :Uncaught TypeError: Object function () { 
                  alert (index);
                  }
           };
      };
  })();
  </code></pre>
  
  <p>What should I write instead <code>book.main.method();</code> to invoke it with out error?</p>
  
  <p>many thanks</p>