Nit:
```javascreipt
while (c.length < len) {
  c = '0' + c;
}
```