title: JavaScript Module Pattern - What about using "return this"?
body: <p>After doing some reading about the Module Pattern, I've seen a few ways of returning the properties which you want to be public. </p>
  
  <p>One of the most common ways is to declare your public properties and methods right inside of the "return" statement, apart from your private properties and methods. A similar way (the "Revealing" pattern) is to provide simply references to the properties and methods which you want to be public. Lastly, a third technique I saw was to create a new object inside your module function, to which you assign your new properties before returning said object. This was an interesting idea, but requires the creation of a new object.</p>
  
  <p>So I was thinking, why not just use <code>this.propertyName</code> to assign your public properties and methods, and finally use <code>return this</code> at the end? This way seems much simpler to me, as you can create private properties and methods with the usual <code>var</code> or <code>function</code> syntax, or use the <code>this.propertyName</code> syntax to declare your public methods.</p>
  
  <p>Here's the method I'm suggesting:</p>
  
  <pre><code>(function() {
  
  var privateMethod = function () {
      alert('This is a private method.');
  }
  
  this.publicMethod = function () {
      alert('This is a public method.');
  }
  
  return this;
  
  })();
  </code></pre>
  
  <p>Are there any pros/cons to using the method above? What about the others?</p>