title: Difference in count++ and count+1 in higher-order functions
body: <blockquote>
    <p>Example 1</p>
  </blockquote>
  
  <pre><code>function makeCounter() {
        let count = 0;
  
        return function() {
          return count++;
        };
      }
  
      let counter = makeCounter();
  
      alert( counter() ); 
      alert( counter() );
  </code></pre>
  
  <p><strong><em>Above alerts 0 and 1 respectively.</em></strong></p>
  
  <hr>
  
  <blockquote>
    <p>Example 2</p>
  </blockquote>
  
  <pre><code>function makeCounter() {
    let count = 0;
  
    return function() {
      return count+1;
    };
  }
  
  let counter = makeCounter();
  
  alert( counter() ); 
  alert( counter() ); 
  </code></pre>
  
  <p><strong><em>This alerts 1 and 1 respectively</em></strong></p>
  
  <p>In programming count++ is equivalent to count+1 , then why is the difference in above two examples. I know its something related to closure property and hoisting. But understand perfectly. Could you guys help.</p>
  
  <p>Note: Please let me know whether I should change the title of the question if it does not make sense.</p>