title: Benefits of using `Object.create` for inheritance
body: <p>I've been trying to wrap my head around the new <code>Object.create</code> method which was introduced in ECMAScript 5.</p>
  
  <p>Usually when I want to use inheritance I do something like this:</p>
  
  <pre><code>var Animal = function(name) { this.name = name; }
  Animal.prototype.print = function() { console.log(this.name); }
  
  var Dog = function() 
  { 
    return Animal.call(this, 'Dog'); 
  }
  
  Dog.prototype = new Animal();
  Dog.prototype.bark = function() { console.log('bark'); }
  </code></pre>
  
  <p>I just assign a newly created Animal object to Dog's prototype and everything works like a charm:</p>
  
  <pre><code>var dog1 = new Dog();
  dog1.print(); // prints 'Dog'
  dog1.bark(); // prints 'bark'
  dog1.name; //prints 'Dog'
  </code></pre>
  
  <p>but people(without explaining) are saying that <code>Dog.prototype = new Animal();</code> is not the way inheritance works and that I should use Object.create approach:</p>
  
  <pre><code>Dog.prototype = Object.create(Animal.prototype);
  </code></pre>
  
  <p>which also works. </p>
  
  <p>What's the benefit of using <code>Object.create</code> or am I missing something?</p>
  
  <p><strong>UPDATE: Some say that <code>Dog.prototype = Animal.prototype;</code> can also work. So now I'm totally confused</strong></p>