title: Variable scope inside IIFE
body: <p>i'm kind of new with JS. So forgive me if the question is too naive.</p>
  
  <p>I'm working with an IIFE like this:</p>
  
  <pre><code>var App = (function() {
  
      var test = '';
  
      var init = function() {
          App.test = 'test';
      };
  
      return {
          init: init
      };
  
  })();
  </code></pre>
  
  <p>Why is App.test exposed if i'm not returning it? I thought only returned variables will be exposed (like App.init). And also, how can I set the value of App.test without exposing it?</p>
  
  <p>By exposing it i mean to be accesible outside the IIFE (ie: console of browser)</p>
  
  <p>Thanks in advance!</p>