title: Javascript simple MVC + module pattern implementation
body: <p>Here is a very basic attempt to create a "hello world"-like JS app using the module and MVC patterns.</p>
  
  <pre><code>var appModules = {};
  
  appModules.exampleModul = (function () {
  
      var _data = ['foo', 'bar']; // private variable
  
      return {
          view: {
              display: function() {
                  $('body').append(appModules.exampleModul.model.getAsString());
              },
          },
          model: {
              getAsString: function() {
                  return _data.join(', ');
              },
          }
  
      };
  
  })();
  
  appModules.exampleModul.view.display();
  </code></pre>
  
  <p>This works fine, but I'm not happy how I have to reference the model function from the view, using the full object path: <code>appModules.exampleModul.model.getAsString()</code>. How can I expose the public model methods to the view, so I could simply use something like <code>model.getAsString()</code>? Or do I need to organize the code differently?</p>