showing results for - "javascript function that generates all combinations of a string "
Kilian
28 Jun 2018
1function combu(s){
2var buff = [];
3var res = [];
4for (i=0;i<s.length;i++){
5    buff = [s[i]];
6    var index=0;
7    while(res[index]){
8        buff.push(''+res[index]+s[i]);
9        index++;
10    }
11    res = res.concat(buff);
12}
13return res;
14}
15
16combu('abc');
Nicole
23 Jun 2020
1 function combString(str){
2     var lenStr = str.length;
3     var result = [];
4     var indexCurrent = 0;
5
6     while(indexCurrent < lenStr){
7         var char = str.charAt(indexCurrent);
8         var x;
9         var arrTemp = [char];
10
11         for(x in result) {
12             arrTemp.push(""+result[x]+char);
13         }
14         result = result.concat(arrTemp);
15
16         indexCurrent++;
17     }
18
19     return result;
20}
21
22console.log(combString("abc"));
queries leading to this page
all combinations of a string javascriptwrite a javascript function that generates all combinations of a stringarbitrary combinations of strings in javascriptprint all combinations of a string javascriptcombination of string in javascriptjs code to find the combinations of a stringjs get all combinations of lettersjavascript print all combinations of a stringjavascript code for number of combinations of a setjs function to get all combinationsjavascript generate all combinations of stringhow to get all combinations of a string jsjs print all possible combinations from a string of charachtersstring number 01 2c02 combination javascriptjavascript function that generates all combinations of a stringgenerate all combinations of string javascriptgenerate all possible commbination for string in java scriptpossible combination from numbers string 121 javascriptsubstring combinations javascriptjavascript print out all possible combinations of a stringhow to show all possible combinations letters can have in javascriptwrite a javascript function that generates all combinations of a string in jspossible string combinations javascriptprogram to generate combinations of a number in javascriptstring combinations in javascripthow to genrate all combination of string in jswrite a function to generate all possible combinations in jsjavascript to generate all combinations of a stringjs all possible combinations from lettersget all combinations of a string jsjavascript function that generates all combinations of a string js get all string combinationsis combination of string in javascripthow to generate all combinations of a string in javascriptcreate a different combinations of string javascriptwrite a javascript function that generates all combinations of a string in javascriptjs create all possible combinations with a string charectwrite a javascript function that generates all combinations of a string all possible combinations of a string in javascripthow do i get combinations of a string in javascriptjs string combinationscombination in javascriptfind combination of a string in javascript function that generates alljs find combinationsjs all possible combinations of stringinput string combination of set program in node jsjavascript function that generates all combinations of a string