title: Javascript: the object field is undefined if passed as 'this' as function parameter
body: <p>I have something like page controller <code>Page</code>,  and I would like to use model <code>Tim</code> and do the callback to the another method from <code>Page</code> controller.</p>
  
  <p>Could you please explain what is going on here?</p>
  
  <p>The code looks like below:</p>
  
  <pre><code>//the model:
  var Tim = function(){};
  Tim.prototype.setDuration = function (duration) {
      this._duration = duration;
  };
  Tim.prototype.count = function(doSomething) {
      doSomething(this)
  }
  
  //the Page controller:
  var Page = function(tim){
      this.tim = tim; // initialisation of this.tim
  };
  Page.prototype.init = function () {
      this.tim.count(this.pollStatus);
  };
  Page.prototype.pollStatus = function(tim) {
      this.tim = tim; // I still have to assign this.tim for the second time
      $.ajax({
            url: 'http://end/point',
            type: "GET",
            success: function (data) {
                 this.tim.setDuration(data.duration); 
            }.bind(this)
       });
  }
  $(document).ready(function () {
       var tim = new Tim();
       var page = new Page(tim);
       page.init();
   })
  </code></pre>
  
  <p>I have to assign this.tim two times, because it is <code>undefined</code> if not.</p>