Prototype and simple inheritance.

Just playing around with prototype, nothing interesting.

by danShumway

JavaScript

var y = function() {
    this.test = "test";
};

y.prototype.test2 = function() {
    alert(this.test);
}

var x = function() {
    this.mynewTest = "heeeeey!";
};
x.prototype = new y();
x.prototype.constructor = x;
x.prototype.test3 = function() {
    alert(this.mynewTest);
    alert(this.test);
};

var z = new x();
z.test2();
z.test3();