title: javascript - adding white space to left of string
body: <p>Is there a better way to add x amount of white space to a string?</p>
  
  <pre><code>str = "blah";
  x = 4;
  
  for (var i = 0; i &lt; x; i++){
    str = ' ' + str;
  }
  
  return str;
  </code></pre>