function obj(x){ output('obj, x: '+x); }; new obj('Declaring usage of prototypes'); obj.prototype.variable = 'This is obj'; // sets the "virtual" class variable variable obj.prototype.dump = function (){ output( this.variable ); // this.variable reads out the virtual variable //of the obj "class", "This is obj" / //"Hello again" in this case }; function inherits(y){ output('inherits, y: '+y); }; inherits.prototype = new obj('Declaring inheritants of inherits'); inherits.prototype.dumpout = function(){ this.dump(); }; var inherits1 = new inherits('Creating object'); // This does not call the function obj, // Therefore I wouldn't call the functions obj / inherits constructors inherits1.dumpout(); function inherits_inherits(){ }; inherits_inherits.prototype = new inherits('Declaring inheritance of inherits_inherits'); inherits_inherits.prototype.dump = function (){ output( 'inherits_inherits: dump called, value of variable: '+ this.variable ); }; var inherits2 = new inherits_inherits(); inherits2.dumpout(); // inherits.dump will now call inherits_inherits.dump, // as expected
So inheritance is quite similar to cpp, except:
  • - Multiple inheritance isn't possible by default
  • - The "virtual constructors" aren't callen every time you create a new instance
  • - There is no public/protected/private concept


There are, however, technics possible to simulate a more cpp like behaviour.


It was possible to enter scripts yourself. Currently, I cannot figure out, how this worked.
Well. Nowadays every browser has it's own debugging engine included, so I leave it the way it is for now.