0

rock paper scissors

okay, so idk why but the output seems to always be You Lose! and i dont know why, any help? https://code.sololearn.com/WVcxdscDjKJ2/?ref=app

18th Apr 2022, 10:46 PM
Junior
Junior - avatar
8 Answers
+ 2
The variable for the computer's choice is rand, not computer.
18th Apr 2022, 11:03 PM
Simon Sauter
Simon Sauter - avatar
+ 2
In lines 9 and 12 replace all occurrences of "computer" with "rand".
18th Apr 2022, 11:30 PM
Simon Sauter
Simon Sauter - avatar
+ 1
And in line 9 you should use parentheses to group the conditions.
18th Apr 2022, 11:31 PM
Simon Sauter
Simon Sauter - avatar
+ 1
if((user === "rock" && rand === "scissors") || (user === "paper" && rand === "rock") || (user === "scissors" && rand === "paper"))
18th Apr 2022, 11:42 PM
Simon Sauter
Simon Sauter - avatar
0
what do you mean? what should i do to fix it?
18th Apr 2022, 11:28 PM
Junior
Junior - avatar
0
ahh yes that makes sense
18th Apr 2022, 11:35 PM
Junior
Junior - avatar
0
how would i group it? Ive seen it before but i never really understood it.
18th Apr 2022, 11:37 PM
Junior
Junior - avatar
0
ahh okay, i see
18th Apr 2022, 11:42 PM
Junior
Junior - avatar