Is not accepting my code? even though this is the same code as next section?


#1
/*var userChoice = prompt("Do you choose rock, paper or scissors?");
var compare = function(choice1, choice2) {
if (choice1 === choice2) {
return "The result is a tie!";
}
};

message:

Oops, try again. Did you create a function called compare?Oops, try again. Did you create a function called compare?

After I reset the code and entered the correct code as mine was missing the {} curly brackets, its still does not accept the correct code and keeps asking the same question about not declaring the function. I have closed down the laptop restarted, reset and closed-reopened the tab just incase it was a glitch.

have i missed something up to now I was following along fine when I entered my code until I got to this part. I have been stuck on this for over three hours. I just want to throw the laptop out of the window at this stage!


#2

turns out we are supposed to remove the comment before submitting the code even though the instructions clearly indicate othrerwise:

We carried over the code from the previous section, but it is a comment. Leave it there for now.

so i left it and was frustrated for over three hours.. I then think I can move on only to find another error that is so unclear and does not help me resolve this..

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

Blimey there are hurdles and there are stupid hurdles that even an athlete would think twice to jump!

Oh I give up this is not worth the stress.. I only have one life and its gonna be a short one with the stress I am having over this!

How ironic....it turns out the second error is because I omitted the exclamation mark! after the word tie!

ye[, this is tying me in knot alright!


#3

The function seems to be ok, but your comment is not closed meaning your whole function is still part of this comment.


#4

thx. i had to remove the comment first for the code to work. I left the comment part as is as the instructions indicated to leave the comment for now so I did not realising it wanted me to then remove the comment for the code to work...only took three hours to figure out...I could have been on a flight to somewhere nice and warm haha.


#5

What I meant is that you only partially removed it, leaving it a comment and removing it completely should have both worked.


#6

yeah I agree - now of course...it only took me 3 hours to work that out! haha pity I never saw your suggestion before hand. At least I am not the only one to experience these errors that arise from minor mistakes. Does teach you to be a little more observant..