Find all subsequences of a string
JavaScript
function findSubSequences(str) {
var len = str.length,
output,
counter = 0;
for (var i = 1; i < Math.pow(2, len); i++) {
output = '';
for (var j = 0; j < len; j++) {
if (i & (1 << j)) {
output += str[j];
}
}
console.log(output);
}
}
findSubSequences('abc');