title: Why can I do 'if (a = 7) ...' but not 'if (var a = 7) ...'?
body: <p>Why does</p>
  
  <pre><code>if (prev = this.Prev()) {
      ...
  }
  </code></pre>
  
  <p>work but</p>
  
  <pre><code>if (var prev = this.Prev()) {
      ...
  }
  </code></pre>
  
  <p>does not?  this.Prev() is a method for a Point object which returns a reference to a previous Point if it exists, and false if it does not.  I don't want to declare the variable to be global, and I don't want something verbose like:</p>
  
  <pre><code>var prev = this.Prev();
  if (prev) {
      ...
  }
  </code></pre>
  
  <p><strong>EDIT:</strong> What's the most elegant way to do something like what I am trying?</p>