5.Both choice are same



your compare function does not return 'the result is a tie' when it is a tie. need help

/*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!";


Hi your return statement should return

return "The result is a tie!";


yes that is the problem i'm having


Hi! try to rebuild your page or better click on the menu on left down corner and take again the lesson #5 both! choices are the same!.
after that, print your code again.
if your problem persist try to copy this code :sweat_smile::

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

just copy and Paste XD


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


Why there is no semi colon after the compare function in your code?

BTW following is giving me a syntax error.

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


There shouldn't be a semi colon, that's why the syntax error

@shilpabadve please open a new topic, code, error and lesson