function substrings(str) {
let arr = [];
for (let x = 0, y = 1; x < str.length; x++, y++) {
arr[x] = str.substring(x, y);
}
let combi = [];
let temp = '';
let len = Math.pow(2, arr.length);
for (let i = 0; i < len; i++) {
temp = '';
for (let j = 0; j < arr.length; j++) {
if (i & Math.pow(2, j)) {
temp += arr[j];
}
}
if (temp !== '') {
combi.push(temp);
}
}
return combi;
}