I am working on the JS rock paper scissors game and I am stuck on a concept that I think has to do with my getComputerChoice function. Everything appeared to be working until I finished the project. When I run the game, it appears as though the computer is choosing 'UNDEFINED" every time. I have confirmed that my number generator is working as intended so I think it must have to do with my return statements. I cannot figure out what is going wrong. I originally had an “else” statement in the determine winner function that would accidentally allow “UNDEFINED” as an option for the computer choice so the game would say the user lost. I fixed that problem and it narrowed down to this. Any feedback is appreciated. My game’s code looks like this:
in your switch statement block:
case rng === 0:
and similarly for the other cases.
rng === 0 would give you
false, and it would check whether
rng matches that, instead of checking whether
You are the bomb!!!
thank you for this.
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.