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 give
function permutations(str){ if (str.length === 1) return str; var permut = []; for (var i=0; i
permutations('the'); //output returns:[ 'the', 'teh', 'het', 'hte', 'eth', 'eht' ]