title: Is there any pre-built method for finding all permutations of a given string in JavaScript?
body: <p>I'm a newbie to the JavaScript world. As the title mentions, I want to know  whether there is any pre-built method in JavaScript to find all possible permutations of a given string.</p>
  
  <p><strong>For example</strong>, given the input:</p>
  
  <pre><code>the
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>the
  teh
  eht
  eth
  het
  hte
  </code></pre>