I just read the following JS code and I got 2 questions:
- Why isn't the container object declared as variable?
- What is"Array.prototype.push.apply" for?
Javascript
Container = function(title, used) {
this.title = title;
this.used= !!used;
this.callbacks = [];
};
Container.prototype.push = function() {
Array.prototype.push.apply(this.callbacks);
};