How can I create a zero-padded string representation of a number in an arbitrary base?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br />
  <a href="http://stackoverflow.com/questions/1267283/how-can-i-create-a-zerofilled-value-using-javascript">How can I create a Zerofilled value using JavaScript?</a>  </p>
</blockquote>

<p>When I convert a # from base 10 to base 16 hex using JavaScript, it doesn't zero pad the number.</p>

<p>For example:</p>

<pre><code>var myBaseTenNumber = 0;
myBaseTenNumber.toString(16);  // should be 00 but it's just 0
</code></pre>

<p>Any easy way to zero pad my number to be 2 digits in length?</p>
