I've been refactoring my code for better performance. This is a simple version of the problem code:
function Thing(x, y) {
this.x = x;
this.y = y;
}
function Square(x, y, size) {
var self = new Thing(x, y);
self.size = size;
return self;
}
And at the time of creating this it worked perfectly fine. The problem now, though, is that I cannot find any simple ways of creating a prototype for square.
Is there anything I'm missing? If not, are there any ways of implementing this kind of "extends" concept and integrating prototypes without rewriting everything?
This has the exact answer you want: Another Stack overflow page
Use Mixins, not as simple as Java or whatever else you may be used to but still possible to do what it is that you want. You will need to write code that is slightly different is all.