The best way to take advantage of objects is to use the prototypal pattern in JavaScript. This means you share data with objects, rather than being stingy and saying "That's mine!".
This pattern is all over the place in JavaScript libraries. It looks something like this:
var Template = {
extend: function () {
var F = function () {};
F.prototype = this.prototype;
var instance = new F();
instance.mixin.apply(instance, arguments);
return instance;
},
mixin: function (mixins) {
for (var i = 0, len = arguments.length; i < len; i++) {
for (var k in arguments[i]) if (arguments[i].hasOwnProperty(k)) {
this[k] = arguments[i][k];
}
}
return this;
}
};
This magical class will share data across inheritance chains, and make your object model simpler. Nothing's a class- everything's an Object! This means understanding minutiae of JavaScript, as to not get yourself stuck in sticky goo, but is well worth it.
This means that when you have:
var Koopa = Template.extend({
hasShell: true,
fatalFlaw: 'shell'
});
var Bowser = Koopa.extend({
fatalFlaw: 'tail'
});
The data stored looks as follows:
+-------------------. +---------------------. +---------.
| Bowser |->| Koopa |->| Template |
+--------------------+ +----------------------+ +----------+
|fatalFlaw => 'tail' | | hasShell => true | | mixin |
`-------------------+ | fatalFlaw => 'shell' | | extend |
`---------------------+ `---------+
This design stems from Father Crockford's prototypal inheritance design. And like Knuth says: "Premature optimization is the root of all evil!"
And... if this seems like an off topic answer- it's intended. You should be asking questions of how your design can serve what your needs are. If you do it well, then everything should fall into place. If you don't think it through enough, you can end up with some nasty side effects and stinky code. Do yourself a favor and come up with a design that eliminates any bit of hesitation you have. Browsers do more complicated and CPU intensive things these days than solve chess!
So, my answer is... don't listen to what people say about efficiency, or what's best (even me!). Do what makes most sense to you, in the design of your library. Right now, you're trying to shove a square peg into a round hole. You need to first decide what your needs are, and everything will come naturally after. It might even surprise you!