title: Javascript nesting objects returns undefined
body: <p>I have this function:</p>
  
  <pre><code>var MyApp = {}; // Globally scoped object
  
  function foo(){
      MyApp.color = 'green';
  }
  
  function test(){
      alert(MyApp.color); // Alerts 'green'
  }
  </code></pre>
  
  <p>But instead of <code>green</code> in alert it says <code>undefined</code>. Why? And how ito fix it.</p>