title: Javascript object value not getting proper value
body: <p>I'm writing a class project (we have to build a Frogger game using HTML5 canvas) and I have a a bunch of objects to help me out with different things like collision detection, movement, ect.</p>
  
  <p>The below object is one of those. Each view contains a Frame object which contains a function call hitTest that checks to see if its frame is colliding with the passed in frame. For some reason, <code>this.lr</code> retains the value that it was originally set to at the beginning of the game and I can't figure out why it's not updating based on the changing origin point.</p>
  
  <pre><code>function Frame(origin, size) {
      this.origin = utility.checkPoint(origin);
      this.size = utility.checkSize(size);
      var self = this;
  
      this.lr = (function () {
          return utility.checkPoint(new Point(self.origin.x + self.size.width, self.origin.y + self.size.height));
      }());
  
      this.tr = (function () {
          return utility.checkPoint(new Point(self.origin.x + self.size.width, self.origin.y));
      }());
  
      this.ll = (function () {
          return utility.checkPoint(new Point(self.origin.x, self.origin.y + self.size.height));
      }());
  
      /* Returns true if the two frames share any common pixels */
  
      this.hitTest = function (frame) {
          var isInXBounds = function (p) {
              return (p.x &gt;= self.origin.x &amp;&amp; p.x &lt;= self.tr.x);
          };
  
          var isInYBounds = function (p) {
              return (p.y &gt;= self.origin.y &amp;&amp; p.y &lt;= self.lr.y);
          };
  
          var isContained = function (p) {
              return (isInXBounds(p) &amp;&amp; isInYBounds(p));
          };
  
          return isContained(frame.origin) || isContained(frame.tr) || isContained(frame.lr) || isContained(frame.ll);
      };
  }
  </code></pre>