title: How to keep track of a previous value within a method in JavaScript?
body: <p>I need to compare a current integer with a previous integar within a method. It seems like something like this should work, but it doesn't. Can someone tell me where the problem lies? Note current is set outside the method.</p>
  
  <pre><code>myMethod : function() {
      var previous;
  
      if ( current &gt; previous ) {
          // do this!
      }
  
      previous = current;
  }
  </code></pre>