title: How to deconstruct a sentence into all possible sub-sentences
body: <p>I have a piece of code that looks up sub-sentences on Wikipedia if it does not find the full one.
  My understanding of array slice was, that a negative n argument would start from the end instead of the begging of the array. So I thought I could do some kind of ZigZag iteration on it. But I was wrong. Can someone point me into the right direction?</p>
  <p>So I did this:</p>
  <pre><code>function splitwords (words, i=0) {
    const parts = words.split(` `);
    const wordcount = parts.length;
  
    let index = i%((wordcount-1)*2)-(wordcount-1); //zigzag
    let par = parts.slice(index);
  
    return par;
  } 
  
  for (let = 0; i &lt; 10, i++) {
    splitwords('Fresh Prince of Bel Air', i) 
  }
  </code></pre>
  <p>My goal would be to this:</p>
  <pre><code>Input: 
  
  Fresh Prince of Bel Air
  
  Output:
  
        Prince of Bel Air
               of Bel Air
                  Bel Air
  Fresh Prince of Bel
  Fresh Prince of
  Fresh Prince
  Fresh
        Prince
               of
                  Bel
                      Air
  </code></pre>
  <p>PS: What is the misconception I have about <code>.slice()</code> ?</p>