View Single Post
Old 10-25-2012, 01:11 PM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Your very first comparison
Code:
if (choice1==="piedra"&&choice2=== "tijeras"){return alert("GANASTE");}
else{return alert("PERDISTE!");}
means: Only return "GANASTE", if choice1 is piedra and choice2 is tijeras, in EVERY OTHER CASE it will return "PERDISTE" and will never do the other checks.

Try this
Code:
if ((choice1==="piedra"&&choice2=== "tijeras")||(choice1==="papel"&&choice2=== "tijeras")||(choice1==="tijeras"&&choice2=== "piedra")){return alert("GANASTE");}
else{return alert("PERDISTE!");}
devnull69 is offline   Reply With Quote