Answer the question
In order to leave comments, you need to log in
How to do the same but with recursion?
There is a code that returns an array of all possible combinations of 3 letters. Those. ['aaa', 'aab', 'aac', ..., 'zzy', 'zzz']
function getWords() {
let arr = [];
for (let i=0; i<26; i++) {
let str = String.fromCharCode(97+i);
for (let i=0; i<26; i++) {
let str2 = str + String.fromCharCode(97+i);
for (let i=0; i<26; i++) {
arr.push(str2 + String.fromCharCode(97+i));
}
}
}
return arr
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question