Lesson 5 syntax help!


#1

Hello fellow coders. On lesson 5 ("Both choices are the same!"), I am having a syntax issue. My code is:

/*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";
comapre("rock","rock");
}
};

Error message: Oops, try again. Your compare function does not return 'The result is a tie!' when there is a tie.

PLEASE HELP!


#2

here my code:
u forget to put the "!"
after the word "The result is a tie"

*return "The result is a tie!";
compare("rock","rock");


#3

I already figured that out, but thanks anyway!


#4

comapre("rock","rock");

what are you doing here?
you are calling the function.right? function should be call after closing the function.


#5

I found it on someone else''s code, tried it out, and it worked out fine. Now I'm just stuck on lesson 6.


#6

it's good you sloved your problem :slight_smile:

simply you should create a new topic :slight_smile:


#7

I already did, and solved it myself!


#8

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