setTimeout doesn't work when closure is included : <p>So I have this piece of code...</p>

<pre><code> var string = 'qwe';

 document.addEventListener('click', function(e){

    function bar(b){

       var a = string[b];
       if (a == 'q') {
          console.log('first');
       }
       if (a == 'w') {
          console.log('second');
       }
       if (a == 'e') {
          console.log('third');
       }

    }       
    setTimeout( bar(0), 1000 );
});
</code></pre>

<p>Problem is setTimeout doesn't work. Code executes right after clicking.</p>

<p>It's weird because if I avoid using the closure, it works...</p>

<pre><code>setTimeout(function bar(){
   var a = string[0];
   //...everything else
},1000 );
</code></pre>

<p>But that would probably make the code messy/redundant, since I plan on doing it 3 times. Ideally the working code would be...</p>

<pre><code>setTimeout( bar(0), 1000 );
setTimeout( bar(1), 2000 );
setTimeout( bar(2), 3000 );
</code></pre>

<p>But again, setting timeOut like this doesn't work for some reason :/ Any ideas why?</p>
