title: how to align values in a column2 starting at fixed index even column1 has string of varied length
body: <p><code>Heading1    Heading2
  FoooBar      23
  FoBar        5
  FooooBar     12</code></p>
  
  <p>In above example, I want the numbers 23 5 and 12 always to be in a line irrespective of the length of first column values. The values in second column should be aligned. How do I do this in Javascript?</p>
  
  <p>I solved this like</p>
  
  <pre><code>function pad(pad, str, padRight) {
  let difference = pad - str.length;
  let exactTab = Math.ceil(difference / 4);
  console.log(exactTab);
    if (typeof str === 'undefined') 
      return pad;
    if (padRight) {
      return Array(exactTab).join('\t');
    } else {
      return (str + difference).substring(0, pad.length);
    }
  }
  </code></pre>