我刚看了下面的JS代码,我有两个问题:
的Javascript
Container = function(title, used) {
this.title = title;
this.used= !!used;
this.callbacks = [];
};
Container.prototype.push = function() {
Array.prototype.push.apply(this.callbacks);
};
答案 0 :(得分:0)
Apply在push函数中设置调用对象。但它似乎没有在这里正确使用。有关调用对象,构造函数和原型的更多信息,请参见:https://stackoverflow.com/a/16063711/1641941