Any FAULT in my code?


#1



I have checked numerous times but I can't seem to fin anything wrong.
However this appears :


" Your code returned 'paper wins' instead of 'rock wins' when the inputs are rock and scissors"


`

This is my CODE :

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

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

}


Any help would be much appreciated !


#2

call the function like
example:

var hello = function() {
console.log("i am saying hello");
};
hello();//Calling the function

here:
compare(arg1,arg2);
@octopussay


#3

Thanks for the reply ! Unfortunately , I don't have to call the function , I just have to write the code right, which my my case I can't understand why It wouldn't work.But I'll check it again :slight_smile:


#4

oops... i didn't see you wrote
"Your code returned 'paper wins' instead of 'rock wins' when the inputs are rock and scissors"
but at last you have to call the function and until you give me the full code i cant help you :slight_smile:


#5

Found it ! I mispelled "scissors" with "scrissors" which compltly blew up my code lol.Thank you anyways :smile: