title: "this" inside object
body: <p>I'm trying to calculate a proportional height (while excluding a static height element) from a width that gets passed in via a request (defaults to 560).</p>
  
  <p>However, <code>wF.h</code> evaluates to <code>NaN</code>. If I replace <code>this.w</code> with 560 it works, but not when trying to reference the <code>w</code> property of <code>wF</code>.</p>
  
  <pre><code>var wF = {
         w : 560,
         h : (312 - 42) / (560 / this.w) + 42
  };
  </code></pre>
  
  <p>What gives?</p>
  
  <p>I refuse to use two plain vars in succession, because I'm trying to get nice code out of JS.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Thanks to everyone who helped explain and solve my problem. I guess i'll just have to get used to that. I'll be setting the object up in stages to get on with the project, even though it still annoys me slightly ;). I found and read a nice article on the topic for anyone who stumbles upon similar issues: <a href="http://yehudakatz.com/2011/08/11/understanding-javascript-function-invocation-and-this/" rel="noreferrer">http://yehudakatz.com/2011/08/11/understanding-javascript-function-invocation-and-this/</a></p>