title: Counting numbers in Functional Programming Style?
body: <p>I'm trying to understand the concept of functional programming. I'm just using javascript here to understand the concepts of it</p>
  
  <p>Usually we would count to 10 in this way :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>for(var i=0;i&lt;10;i++){
   console.log(i+1)
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>is this the Functional Programming Equivalent?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var a = 1;
  var n = 10;
  
  function counter(){
    console.log(a);
    if(a&lt;n){
      counter(++a);
    }
  }
  
  counter();</code></pre>
  </div>
  </div>
  </p>