title: Print a triangle right to left
body: <p>I'm begining with programming. I'm using javascript.</p>
  
  <p>For practice, I print a triangle like this:</p>
  
  <pre><code>*
  **
  ***
  ****
  *****
  </code></pre>
  
  <p>but I want to print right to left, like this: </p>
  
  <pre><code>    *
     **
    ***
   ****
  *****
  </code></pre>
  
  <p>So, with my noob knowledge, I wrote this code:</p>
  
  <pre><code>var line = '';
  
  var size = 5;
  
  for (var i = 0; i &lt;= size; i++) {
      for (var j = 0; j &lt;= size; j++) {
          if (j == size - i) {
              line += '#';
              if (i != 0) {
                  for (var k = j; k &lt; size; k++) {
                      line += '#';
                  }
              }
          } else {
              line += ' ';
          }
      }
  
      line += '\n';  
  }
  
  console.log(line);
  </code></pre>
  
  <p>It works! But I think it's awful. </p>
  
  <p>Could someone give me some advice?</p>
  
  <p>Thanks very much!</p>