Why do we need apply method inside the constructor to invoke any method defined on the prototype object?
<p>Why do we need apply method inside the constructor to invoke any method defined on the prototype object?</p>

<p>Code working:</p>

<pre><code>    function Test(){
    this.x = [];
    this.add.apply(this,arguments);
    }

    Test.prototype.add = function(){
    for(var i=0; i &lt; arguments.length; i++){
    this.x.push(arguments[i]);
    }
    }

    var t = new Test(11,12)

    t.x          //[11,12]  this is fine
    t.x.length   //2 this is also fine
</code></pre>

<p>But when i directly call add inside constructor</p>

<p>Code not working:</p>

<pre><code>    function Test(){
    this.x = [];
    this.add(arguments);
    }

    Test.prototype.add = function(){
    for(var i=0; i &lt; arguments.length; i++){
    this.x.push(arguments[i]);
    }
    }

    var t = new Test(11,12);
    t.x.length; //1 Not added all elements why?
</code></pre>

<p><img src="http://i.stack.imgur.com/g4EeM.png" alt="enter image description here"></p>
