title: IIFE and parameter
body: <p>Here's a code</p>
  
  <pre><code>(function(x){
      // Some code here
  })(1);
  </code></pre>
  
  <p>The code above is IIFE so this means that it will be executed just once.
  Qustion: why would anybody need to pass parameter into this function (whick is 1 in example below)?</p>
  
  <p>I can just create variable inside function, like below</p>
  
  <pre><code>(function(){
      var x = 1;
      // Some code here
  })();
  </code></pre>
  
  <p>This question is not about how closures work but about why and when to use first code pattern and when the second one.</p>