setInterval Variable Scope
<p>I have a variable declared at the top of my function as <code>this.current_test = null;</code> and then down the line I have a setInterval function and I need to set the variable to a new parameter...</p>

<p><code>this.current_test.failed = true;</code></p>

<p>Code:</p>

<pre><code>timer = this.window.setInterval(function() 
   {
      this.window.clearInterval(timer);
      this.current_test.failed = true;
   },1000);
 }
</code></pre>

<p>However I am getting a <code>TypeError: 'undefined' is not an object (evaluating 'this.current_test.failed = true'</code> error</p>

<p>And I assume this is because this.current_test is not defined inside the setInterval function, so how can I edit that variable?</p>
