Code academy friends, I need you :) , stuck in 8/9 ! :(


#1

https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/1/4?curriculum_id=506324b3a7dffd00020bf661

I am stuck at the 8/9 level " what if choice1 is scissors?"

Hello, I don't know what's wrong with my code, can you help me? Thanks

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
	computerChoice = "rock";
} else if(computerChoice <= 0.67) {
	computerChoice = "paper";
} else {
	computerChoice = "scissors";
} console.log("Computer: " + computerChoice);
var compare = function(choice1,choice2)
{
    
    
if (choice1 === choice2)
{return "The result is a tie!";}
else if
(choice1 === "paper")
{
    if 
    (choice2 === "rock")
    { return "paper wins";}
    else 
    { return "scissors wins";};};

else if
(choice1 === "scissors")

{
   
    if
    (choice2 === "rock")
    { return "rock wins";}
    else 
    { return "scissors wins";}
    ;}
    ;}
    compare(userChoice,computerChoice)

    Thank you


#2

I've been staring at this for like ten minutes now just to be sure but you seem to be missing a statement for choice1===rock


#3

@lord_cypher makes a good observation.

I would suggest looking at your syntax following both of your { return "scissors wins" } code blocks.


#4

Hello, I have reset the code in order to restarting all, because I haven't found the problem source.
Thank you for your time anyway, that's nice of you :slight_smile:


#5

Hello, thank you for your reply :slight_smile:


#6

@webcoder06293 Don't give up, your code is very close to being done. Do a google search for jsbin and plug your code in on that site, it helped me a lot. You can do it!


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.