In JavaScript, defining a classlike (constructor) function method is usually done like this:
function Class1() {
// ... code ...
}
Class1.prototype.method1 = function(args) {
// ... code ...
};
And going by the general syntax/semantics rules of ECMAScript, there is no reason I couldn't override/alter/extend the original Object.prototype with
function Class1() {
// ... code ...
this.prototype.method1 = function(args) {
// ... code ...
};
}
Then why is it not done that way? Code would look a bit more confusing, but a lot quicker and cleaner to write and read (putting all Class1-related methods right underneath Class1 itself). Wouldn't it be a better use?