Possible Duplicate:
How can I create a Zerofilled value using JavaScript?
In JavaScript, I need to have padding.
For example, if I have the number 9, it will be "0009". If I have a number of say 10, it will be "0010". Notice how it will always contain four digits.
One way to do this would be to subtract the number minus 4 to get the number of 0s I need to put.
Is there was a slicker way of doing this?
You did say you had a number-
For fun, instead of using a loop to create the extra zeros:
Funny, I recently had to do this.
Use like:
Not beautiful, but effective.