How can I create a Zerofilled value using JavaScript?

Posted by Wilco on Stack Overflow See other posts from Stack Overflow or by Wilco
Published on 2009-08-12T16:33:36Z Indexed on 2010/05/08 10:08 UTC
Read the original article Hit count: 198

Filed under:
|

What is the recommended way to zerofill a value in JavaScript? I imagine I could build a custom function to pad zeros on to a typecasted value, but I'm wondering if there is a more direct way to do this?

Note: By "zerofilled" I mean it in the database sense of the word (where a 6-digit zerofilled representation of the number 5 would be "000005").

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about zerofill