Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2 from danzajdband/master

Now it should work
  • Loading branch information...
commit 0a72e37a876f2a3d6f145d75648dd6ab3fbdc4fb 2 parents 642f2d4 + 4893c79
@tj tj authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 index.js
View
5 index.js
@@ -99,14 +99,13 @@ Counter.prototype.updateDigit = function(i, val){
Counter.prototype.update = function(n){
this.n = n;
- var digits = this.total;
var str = n.toString();
var len = str.length;
+ var digits = Math.max(len, this.total);
this.ensureDigits(len);
-
for (var i = 0; i < len; ++i) {
- this.updateDigit(digits - i - 1, str[i]);
+ this.updateDigit(digits - i - 1, str[len - i - 1]);
}
return this;
Please sign in to comment.
Something went wrong with that request. Please try again.