title: Way to add leading zeroes to binary string in JavaScript
body: <p>I've used .toString(2) to convert an integer to a binary, but it returns a binary only as long as it needs to be (i.e. first bit is a 1).</p>
  
  <p>So where:</p>
  
  <pre><code>num = 2;
  num.toString(2) // yields 10. 
  </code></pre>
  
  <p>How do I yield the octet 00000010?</p>