(number, width)
| 77 | } |
| 78 | |
| 79 | function zeroFill(number, width) { |
| 80 | width -= number.toString().length; |
| 81 | |
| 82 | if (width > 0) { |
| 83 | return new Array(width + (/\./.test(number) ? 2 : 1)).join('0') + number; |
| 84 | } |
| 85 | |
| 86 | return number + ""; // always return a string |
| 87 | } |
| 88 | |
| 89 | function zeroFill(number, width) { |
| 90 | width -= number.toString().length; |