title: Javascript function always returns true?
body: <p>I have this function which is a property of an object,</p>
  
  <pre><code>Layer.prototype.mouseInBounds = function() {
  
      // Return value
      var ret = true;
      // Layer mouse co-ordinates are not valid
      if (this.mouse.x &lt; 0 || this.mouse.y &lt; 0 || this.mouse.x &gt;= this.width || this.mouse.y &gt;= this.height) {
          // Set layer mouse co-ordinates to false
          this.mouse.x = false;
          this.mouse.y = false;
          // Set return value
          ret = false;
      }
      return ret;
  };
  </code></pre>
  
  <p>But when I call it like so from within another object that has the layer as a property,</p>
  
  <pre><code>this.layer.mouseInBounds() // true
  </code></pre>
  
  <p>No matter what the value of <code>ret</code> inside of the <code>mouseInBounds</code> function?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>To better understand my question <code>mouse</code> is a property of layer, and when adding</p>
  
  <pre><code>console.log(ret);
  </code></pre>
  
  <p>Just before the return statement I do indeed get either <code>true</code> or <code>false</code>,</p>