Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var str = "abcde";
- var length = str.length;
- var conterIndx = 0;
- var result = [];
- debugger;
- var processStr = function(str, idx) {
- if(idx == str.length) {
- return;
- }
- var char = str.charAt(idx);
- var tempArr = [char];
- for(var res in result) {
- tempArr.push("" + result[res] + char);
- }
- result = result.concat(tempArr);
- idx++;
- processStr(str, idx);
- return result;
- }
- var res = processStr(str, conterIndx);
- console.log(res);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement