Which of these should be the better approach to write JavaScript code?
<p>Which should be the better approach to write JavaScript code, and why?</p>

<p>1) </p>

<pre><code>var myClass = function(){}

myClass.prototype.init = function(x, y){
    this.width = x;
    this.height = y;
}

myClass.prototype.show = function(){
    alert("width = "+ this.width+" height = "+ this.height);
}
</code></pre>

<p>2) </p>

<pre><code>var myObj = {
    init : function(x, y)
    {
        this.width = x;
        this.height = y;
    },
    show : function()
    {
        alert("width = "+ this.width+" height = "+ this.height);    
    }           
}
</code></pre>
