Passing a variable into a function within a function
<p>I trying to pass a variable down one level into a setInterval function my code looks something like this:</p>

<pre><code>function file_copy_progress(directory){
    console.log("stage 1 " + directory);
    setInterval(function(directory){
        console.log("stage 2 " + directory);
    }, 1000);
}
</code></pre>

<p>then I call it like this:</p>

<pre><code>file_copy_progress("/home/user/tmp/test");
</code></pre>

<p>The result in the console is:</p>

<pre><code>stage 1 /home/user/tmp/test
stage 2 undefined
stage 2 undefined
stage 2 undefined
...
</code></pre>

<p>How would I pass the <code>directory</code> variable down one more level to be available in the setIntervall function?</p>
