Forum Moderators: open
function foo () {
this.history = [];
}
foo.prototype.method1 = function () {
this.history.push('method1');
return this;
}
foo.prototype.method2 = function () {
this.history.push('method2');
return this;
}
foo.prototype.logHistory = function () {
console.log(this.history);
return this;
}
var bar = new foo().method1().method2().logHistory().method2().logHistory();