Step 7, what is wronggggg


#1

it keeps saying "SyntaxError: Unexpected keyword 'else'"


#2

Hi you should close the else if statement add a "}" after the else statement


#3

that doesn't seem to work


#4

Try to post your code.


#8

{if(choice1 === choice2)
return "The result is a tie!"
}
else if (choice1==="paper") {
if (choice2==="rock") {
return "paper wins"
}
else{
return "scissors wins"

}
}


#9
`{if(choice1 === choice2) 
        return "The result is a tie!"
}
else if (choice1==="paper") {
    if (choice2==="rock") {
        return "paper wins"
}
    else{
        return "scissors wins"

}

}


#10

His missing this part

else if(choice1 === "rock") {
    if(choice2 === "scissors") {
        return "rock wins";
}
    else {
        return "paper wins"
}
}

#11

no its the fact that my code doesn't work

it keeps saying

SyntaxError: Unexpected keyword 'else'


#12

If you don't have all the code you can't pass the lesson Try to see the code of @cdisninjy it's how your code should be on this step.


#13

if(choice1 === choice2) { <--put a bracket here and a } at the very bottum


#14

YES!!! thank you so much! thats exactly what it needed!


#15

Yes! I confused myself at one point there. Glad I could help.


#16

I think im getting confused on syntax...

I keep writing it like this

var compare = function(choice1, choice2) {
if (choice1 === choice2) {
return "The result is a tie!"
}
}

Also, your code while it may work I think has extra code maybe?

the first direction asks for choice1 === "paper"

This gave me a successful run

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"
}
}


#17

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


#18

See now if I were to pick rock. scissors would win. In step 6 it tells you that you need the else inside that else/if. Also even if it were in there if I picked rock or scissors it would still skip that chunk of code and do nothing which is why you are supposed to add an else/if in each step. 6-8. 6 having the what if choice1 is rock? 7 having what if choice1 is paper? 8 having what if choice1 is scissors?


#19

Thanks for all the help!