倒计时
function Countdown(seconds) {
this._seconds = seconds;
}
Countdown.prototype._step = function() {
console.log(this._seconds);
if (this._seconds > 0) {
this._seconds -= 1;
} else {
clearInterval(this._timer);
}
};
Countdown.prototype.start = function() {
var _this=this;
_this._step();
_this._timer = setInterval(function() {
_this._step();
}, 1000);
};
new Countdown(10).start();