Declaring variables with this or var?
<p>What is the difference between declaring a variable with <code>this</code> or <code>var</code> ?</p>

<pre><code>var foo = 'bar'
</code></pre>

<p>or</p>

<pre><code>this.foo = 'bar'
</code></pre>

<p>When do you use <code>this</code> and when <code>var</code>?  </p>

<p>edit: is there a simple question i can ask my self when deciding if i want to use <code>var</code> or <code>this</code> </p>
