Different ways to add functions to Javascript object
<p>In Javascript is there any difference between these two ways of adding a function to an object?  Is one preferable for any reason?  </p>

<pre><code>    function ObjA() {
        this.AlertA = function() { alert("A"); };
    }
    ObjA.prototype.AlertB = function() { alert("B"); };

    var A = new ObjA();
    A.AlertA();
    A.AlertB();
</code></pre>
