JavaScript -recommended testable pattern
<p>I read about 2 JavaScript testable patterns, but I am not sure how they differ and which one should I use.</p>

<p>Pattern 1:</p>

<pre><code>function class () {
    this.propertyA = null;
    this.methodA = function() {
        alert('');
    }
}

var object = new class();
object.methodA();
</code></pre>

<p>Pattern 2:</p>

<pre><code>var object = (function() {
    var propertyA = null;
    return {
        methodA: function() {
            alert('');
        }
    }
}());
var object = new class();
object.methodA();
</code></pre>

<p>What are the differences? Which one should I use for unit testing with jQuery's QUnit? Please note that jQuery plugins are not an option for my requirements (not UI testing, business logic only). Thank you.</p>
