0
我是新的面向对象的JavaScript。试图制作一个对象构造函数。 这里是我的代码javascript:当声明一个原型方法:错误是无效的左侧赋值
function Collection() {
this.ports = build_ports_collection();
this.all_things = build_things_collection();
this.added_things = function() {
this.added_things.total_added = 0;
var temp = this.all_things;
temp.splice($(sth).val(), 1);
this.added_things.all = temp;
};
};
Collection.ports.prototype.reload = function() {
Collection.ports = build_ports_collection();
};
Collection.all_things.prototype.reload = function() {
Collection.all_things = build_things_collection();
};
Collection.added_things.all.prototype.reload() = function() {
var temp = Collection.all_things;
temp.splice($(sth).val(), 1);
Collection.added_things.all = temp;
};
Collection.added_things.prototype.add_things = function() {
this.added_things.total_added++;
add_things();
};
Collection.added_things.prototype.remove_things = function() {
this.added_things.total_added--;
remove_things();
};
我收到错误的行Collection.added_things.all.prototype.reload()= ....
netbeans的报告:无效的左手侧的分配。
这里我的目的是绑定的方法重载()来Collection.added_things.all,这样它会收集
我缺少点什么的所有实例之间共享?
我明白了, 非常感谢这么快的回应:) – minhajul