title: Javascript convert string to binary with a fixed length
body: <p>Is there an <strong><em>elegant</em></strong> way to convert some string to binary and get a result with a fixed length?<br>
  The built-in function is: <code>parseInt(str, 10).toString(2)</code>, but it's cutting the length.</p>
  
  <p>For example, if I want length = 8 bits, then <code>myFunction("25")</code> will return <code>00011001</code> instead of just <code>11001</code>.   </p>
  
  <p>I know that I can append zeros to the beginning, but it doesn't seems like an elegant way to me.</p>