title: How to pass parameters to setTimeout function
body: <p>I am relatively novice to javascript. I have written a simple counter program that starts count down from 10 till it reaches 1.</p>
  
  <pre><code>  &lt;script type="text/javascript"&gt;
      function countDown(secs) {
          var element = document.getElementById("status");
          element.innerHTML = "Please wait for "+secs+" seconds";
          if(secs &lt; 1) {
              clearTimeout(timer);
              element.innerHTML = '&lt;h2&gt;Countdown Complete!&lt;/h2&gt;';
              element.innerHTML += '&lt;a href="#"&gt;Click here now&lt;/a&gt;';
          }
          secs--;
   ---&gt;       **var timer = setTimeout('countDown('secs')',1000);**
      }
      &lt;/script&gt;
      &lt;div id="status"&gt;&lt;/div&gt;
      &lt;script type="text/javascript"&gt;countDown(10);&lt;/script&gt;
  </code></pre>
  
  <p>Then I tried passing parameter as <code>'+secs+'</code> to the countDown function. </p>
  
  <pre><code>var timer = setTimeout('countDown('+secs+')',1000);
  </code></pre>
  
  <p>Above change works. </p>
  
  <p>My question is why should I need to pass parameter as '+secs+' and NOT only 'secs' ?
  What difference does it make?</p>