title: Incrementing the number is not working in Nodejs
body: <p>I have the following function in my counter.js file:   </p>
  
  <pre><code>//counter.js
  var counter = 1;
  
  function increment() {
    counter++;
  }
  
  function decrement() {
    counter--;
  }
  
  function getCounter() {
    return counter;
  }
  
  module.exports = {
    counter: counter,
    increment: increment,
    decrement: decrement,
    getCounter: getCounter
  };
  </code></pre>
  
  <p>In my main.js, I have the following code:  </p>
  
  <pre><code>//main.js
  var counter = require('./counter');
  counter.increment();
  console.log(counter.counter); // 1
  console.log(counter.getCounter()); // 2
  </code></pre>
  
  <p>I am unable to understand, why does the </p>
  
  <blockquote>
    <p>counter.counter</p>
  </blockquote>
  
  <p>gives 1 as output, whereas the </p>
  
  <blockquote>
    <p>counter.getCounter()</p>
  </blockquote>
  
  <p>gives 2 as the output.<br>
  What is the possible explanation for this behavior?</p>