Edit in JSFiddle

function GrandParent(){
  this.me = "GrandParent";
  function Parent(){
    this.me = "Parent";
    function Child(){
      this.me = "Child";
    };
    Child();
  };
  Parent();
};


var whoAmI = new GrandParent();
$('body').append(whoAmI.me);
$('body').append('</br></br>');
function FixedGrandParent(){
  var self = this;
  self.me = "GrandParent";
  function Parent(){
    self.me = "Parent";
    function Child(){
      self.me = "Child";
    };
    Child();
  };
  Parent();
}

var fixedWhoAmI = new FixedGrandParent();
$('body').append(fixedWhoAmI.me);