I\'m trying to create a function in JavaScript that given a string will return an array of all possible combinations of the letters with each used at most once, starting wit
var combinations = function (string)
{
var result = [];
var loop = function (start,depth,prefix)
{
for(var i=start; i 0)
loop(i+1,depth-1,next);
else
result.push(next);
}
}
for(var i=0; i