title: Printing triangle with word characters in JavaScript using recursion only
body: <p>Interview Question: I was asked to write a recursive JavaScript function that takes an P character long String as input, and prints out the following:</p>
  
  <ol>
  <li>The first line prints the first character of the string</li>
  <li>The second line prints the first two characters of the string</li>
  <li>and so on until Pth line prints all the characters of the string</li>
  <li>(P+1)th line prints first (P-1) characters</li>
  <li>(P+2)th line prints first (P-2) characters</li>
  <li>and so on until (2P -1) th line prints only the first character</li>
  </ol>
  
  <p>And if we run the function  : printTriangle("A Joke")</p>
  
  <p>It will printout the following:</p>
  
  <p>A</p>
  
  <p>A</p>
  
  <p>A J</p>
  
  <p>A Jo</p>
  
  <p>A Jok</p>
  
  <p>A Joke</p>
  
  <p>A Jok</p>
  
  <p>A Jo</p>
  
  <p>A J</p>
  
  <p>A</p>
  
  <p>A</p>
  
  <p>I was asked to write this function in the interview, I could only write using iterative approach. Still wondering how to write that using recursive approach, can anyone enlighten?</p>