var rps = function (rounds){
var results = [];
var posbt = ['r', 'p', 's']
var play = function(playSo, rounds ){
if(rounds === 0){
results.push(playSo);
return;
}
for (var i = 0; i < 3; i ++){
play(playSo + posbt[i], rounds - 1 );
}
}
play('', rounds);
return results;
}
var maple = rps(1);
maple;
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>
) will also add backticks around text.
Note: Backticks are not single quotes.
there are no syntax errors in your code.
What should your code do?
What output for what input?
What is happening instead?
I can’t read your mind
Excuse me
The goal of the game is to repeat every possibility three times, starting from the first possibility
I have still not the faintest idea what your function should do:
what’s the input? what should be the output? what’s the logic that links the two?
I think the problem that I mean from it is the link between the inputs and the output of the idea
Would you please advise in general not just the problem
is it a challenge you are doing from somewhere?
I have no idea how to help, as I don’t know what the issue is
No, there is no challenge
I just try to learn
But I have some problem with the methodology of linking
if you explain what your code should do I may be able to help. Otherwise I can’t help you.
What should be the input?
What should be the output?
How are the two connected? (what’s the logic that links the two? And I do not mean in code, I mean like “the input is a string, the output is the length of the string”, “the input is an array of numbers, the output is the number resulting in summing all the numbers in the array”)
I have no idea what you want to do with your code, so I have no idea what help I could give you