evil scrabble cheat thing
by Joseph Tate
JavaScript
function combinations(str) {
var fn = function(active, rest, a) {
if (!active && !rest)
return;
if (!rest) {
if (active.length > 1) {
a.push(active);
}
} else {
fn (active + rest[0], rest.slice(1), a);
fn (active, rest.slice(1), a);
}
return a;
}
return fn ('', str, []);
}
console.log(combinations('abcdefghijk'));