en.javascript.info/02-ui/05-widgets/02-widgets-structure/07-voter-add-doublevote/solution/voter-step/step-voter.js
Ilya Kantor f301cb744d init
2014-10-26 22:10:13 +03:00

13 lines
No EOL
331 B
JavaScript
Executable file

function StepVoter(options) {
Voter.apply(this, arguments);
this._step = options.step || 1;
}
StepVoter.prototype = Object.create(Voter.prototype);
StepVoter.prototype._increase = function() {
this.setVote(this._vote + this._step);
};
StepVoter.prototype._decrease = function() {
this.setVote(this._vote - this._step);
};