var foo = function (param) {
this.property = param;
};
foo.prototype = {
constructor: foo,
method: function () {
return this.property;
}
};
var object = new foo (2);
alert(object.method()); // 2
object.constructor.prototype.method_2 = function() {
return this.property * 2;
};
var object_2 = new foo(3);
alert([
object.method_2(), // 4
object_2.method_2(), // 6
new foo(3).method_2() // 6
]);