title: What difference between This and That
body: <p>I'd like to know and understand the different between this and that, and when I have to use it.
  I ready many post and many tutorial but I don't understand yet</p>
  
  <p>this is my class</p>
  
  <pre><code>function Container(param) {
  
      function dec() {
          if (secret &gt; 0) {
              secret -= 1;
              return true;
          } else {
              return false;
          }
      }
  
      this.member = param;
      var secret = 3;
      var that = this;
  
      this.service = function () {
          console.log(this.member); // foo
          console.log(that.member); // foo
          return dec() ? that.member : null;
      };
  }
  </code></pre>
  
  <p>New</p>
  
  <pre><code>var myContainer = new Container('foo');
  myContainer.service()
  </code></pre>
  
  <p>Calling <code>myContainer.service()</code> will return 'abc' the first three times it is called. 
  After that, it will return null</p>
  
  <p>Why i have to do <code>var that = this</code> ??</p>