8. what if choice1 is scissors (please help meee <3)


#1

https://www.codecademy.com/en/courses/javascript-beginner-en-Bthev-mskY8/1/4?curriculum_id=506324b3a7dffd00020bf661


So basically i am so stuck, i am having so much trouble understanding this and it would be great if someone could explain it more or know of a video that can explain it.. also im just so stick with the question and the code ughhh


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!";
}
    else if (choice1 === "paper") {
        if (choice2 === "rock") {
        return "paper wins";
        }
        else {
            return "scissors wins"
        }
		
		
	}
    
    
    
};



console.log(computerChoice(choice1, choice2));

This is my code so far, and the question is so...
1. Under your old code, use the same structure as the past two exercises and finish off your function.

  1. We need to use the variables userChoice and computerChoice. Uncomment the first lines of the code by deleting /* on line 1 and */ on line 9, the variables are now active and can be called.

3.Call your function and pass in userChoice and computerChoice as your two arguments.
Press Save & Submit Code and your game should work! Congratulations!

I do not get this at all and would be much appreciated if someone could help


#2

When they say arguments, they mean your function parameters. We've been using choice1 and choice2 until this point.


#3

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