Variable scope and sharing information without global variables
<p>If I have: </p>

<pre><code>function firstFunction(){
    var counter = 0;
    secondFunction();
    secondFunction();
    secondFunction();
    secondFunction();
}
function secondFunction(){
    counter++;
}
</code></pre>

<p>I get an error because of the local scope of the variable, but how else am I to do something like this without using global variables?</p>
