title: Multi Level Inheritance in Javascript
body: <p>I am trying to mock inheritance in Javascript using prototype.</p>
  
  <p>I have a function named Model and a type of model => Item.</p>
  
  <pre><code>var Model = function() { 
     this.names = ["name1", "name2"]; 
  } 
  Model.prototype.Item = function(args) { 
     this.init = function(item_name) { 
        this.names[0] = item_name; // ERROR: Cannot set property '0' of undefined
     } 
  }
  var m = new Model();
  var i = new m.Item();
  i.init("New Name"); // ERROR: Cannot set property '0' of undefined
  </code></pre>
  
  <p>How can I access <code>names</code> array from <code>init()</code> function above?</p>