Permalink
Browse files

fixed

  • Loading branch information...
1 parent 4c55392 commit 4893c79074f2d4eb46f78c9e986525c75605a29a @impronunciable impronunciable committed Oct 18, 2012
Showing with 1 addition and 3 deletions.
  1. +1 −3 index.js
View
@@ -62,7 +62,6 @@ Counter.prototype.ensureDigits = function(n){
while (this._digits.length < n) {
this.addDigit();
}
- this.total = n;
};
/**
@@ -102,10 +101,9 @@ Counter.prototype.update = function(n){
this.n = n;
var str = n.toString();
var len = str.length;
+ var digits = Math.max(len, this.total);
this.ensureDigits(len);
- var digits = this.total;
-
for (var i = 0; i < len; ++i) {
this.updateDigit(digits - i - 1, str[len - i - 1]);
}

0 comments on commit 4893c79

Please sign in to comment.