title: How to print out N spaces in Javascript?
body: <p>In Javascript, the method to print out using</p>
  
  <pre><code>console.log("this is %s and %s", foo, bar);
  </code></pre>
  
  <p>works, so it follows some C style, but it doesn't follow</p>
  
  <pre><code>console.log("%*s this is %s and %s", 12, foo, bar);
  </code></pre>
  
  <p>where the <code>%*s</code> and <code>12</code> is to make it print out 12 spaces, as in this question:     <a href="https://stackoverflow.com/questions/10702678/in-objective-c-how-to-print-out-n-spaces-using-stringwithcharacters">In Objective-C, how to print out N spaces? (using stringWithCharacters)</a></p>
  
  <p>Is there a short, quick way to make it work simply in Javascript?  (say, without using the <code>sprintf</code> open source library or writing a function to do it?)</p>
  
  <p><strong>Update:</strong>, in my case, 12 is actually a variable, such as <code>(i * 4)</code>, so that's why it can't be hardcoded spaces inside the string.</p>