我想将以下想法用于 Javascript 中的类系统。
var base = Object.create(
Object.prototype,
{
extend: {
value: function extend (properties) {
var child = Object.create(this);
for (var p in properties) {
child[p] = properties[p];
}
return child;
}
},
make: {
value: function make () {
var child = Object.create(this);
if (child.init) child.init();
return child;
}
}
});
var animal = base.extend();
var cat = animal.extend(
{
init: function init () {
this.lives = 9;
}
}
);
var ares = cat.make();
但是 firebug 和 chromium 中的调试器和控制台将每个实例称为对象。这很烦人。我怎样才能解决这个问题?