title: JS: Nested object which will inherit from the main object's prototype
body: <p>I'm wondering if it is a good design to have an object with a property which will inherit from the same prototype as the object. Consider the following piece of code:</p>
  
  <pre><code>let Sme = {
      e164Addr,
      ton,
      normalise : function(){
          // normalise e164Addr to international
        this.ton = 1;
  
        return 0;
      }
  }
  
  let Sim = Object.create(Sme);
  Sim.setIMSI = function(imsi){
     this._imsi = imsi;
  }
  Sim.getIMSI = function(){
     return this._imsi;
  }
  Sim.setLocation = function(vlrAddr, ton){
     this._vlr = Object.create(Sme);
     this._vlr.e164Addr = vlrAddr;
     this._vlr.ton = ton;
     this._vlr.normalise();
  }
  Sim.getLocation = function(){
     return this._vlr;
  }
  
  function createSim(msisdn, ton){
     let sim = Object.create(Sim);
     sim.e164Addr = msisdn;
     sim.ton = ton;
  
     return sim;
  }
  
  let sim = createSim('359883123456', 1);
  sim.setLocation('359881234567', 1);
  </code></pre>
  
  <p>I'm talking about the sim._vlr property whose __proto__ is Sme (the same as Sim's).</p>