title: Combination of a letter using recursive
body: <p>Suppose, if I give <strong>'ABC' as input</strong> then then I want <strong>'ABC', 'ACB', 'CAB', 'CBA', 'BAC', 'BCA'</strong>. Each word has <strong>combination of n!</strong> where n is length of letter. I think recursion can make it easier. Here is my code written in javascript :</p>
  
  <pre><code>function reArrange(word)
  {
      console.log(word);
      if (word.length &lt; 0) {
          return (-1);
      }
      else if (word.length == 0) {
          return ('');
      }
      else {
          for (var _i = 0; _i &lt; word.length; _i++) {
              var temp = word[_i];
              for (var _j = 0; _j &lt; word.length; _j++) {
                  if (_i != _j) {
                      return word[_i] + reArrange(word.slice(_i, word.length));
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>Please use detailed comment.</p>