Using Object.create() to develop a prototype chain
<p>I have seen people writing this when want to extend another class:</p>

<pre><code>Test2.prototype = Object.create( Test1.prototype );
</code></pre>

<p>But I did this too:</p>

<pre><code>Test2.prototype = Test1.prototype;
</code></pre>

<p>And works (at least in the following example):</p>

<pre><code>var Teste1 = function() 
{
    this.value = 'Teste1';
}
Teste1.prototype = {
    value:'no-class',
    print:function()
    {
        console.log( this.value );
    }
}

var Teste2 = function()
{
    Teste1.apply( this );
}
Teste2.prototype = Teste1.prototype;

var t = new Teste2();
t.print();
</code></pre>

<p>The console prints <code>Teste1</code>, which means Teste1 constructor was called. The real questions are:</p>

<p>Why do we need use <code>Object.create</code> when extending classes in javascript?
Will I get a problem with this idea of code in the future on the project?</p>

<p>thanks.</p>
