I need halp with lesson 13?


#1

https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/2/5?curriculum_id=506324b3a7dffd00020bf661

It says that my ReferenceError: fuction is not defined but passes me to next lesson as if it was correct.

var userChoice = prompt("Do you choose Rock, Paper, Scissors ?");
var secondPlayerChoice = prompt("What Do you choose Second Player?");


console.log("First Player Player choose: " + userChoice);
console.log("Second Player choose: " + secondPlayerChoice);
   var compare = fuction(userChoice,secondPlayerChoice);
   {
   
      if (userChoice === secondPlayerChoice) {
    console.log("The result is a tie!\nPlease make a new choice...");
      }
       if (userChoice  === "Rock") {
        if (secondPlayerChoice=== "Paper") {
           console.log( "Paper Wins!");
        } else if (userChoice=== "Scissors") {
           console.log( "Rock Wins!");
        } else {
            console.log( "Rope Wins!");
        }
    }
    if (userChoice === "Paper") {
        if (secondPlayerChoice === "Rock") {
            console.log( "Rock Wins!");
        } else if (secondPlayerChoice  === "Scissors") {
           console.log( "Scissors Wins!");
        } else {
           console.log( "Rope Wins!");
        }
    }

    if (choice1 === "Scissors") {
        if (choice2 === "Rock") {
            console.log( "Rock Wins!");
        } else if (choice2 === "Paper") {
            console.log( "Scissors Wins!");
        } else {
            console.log("Scissors Wins!");
        }
    }

    if (choice1 === "Rope") {
        if (choice2 === "Rock") {
           console.log("Rope Wins!");
        } else if (choice2 === "Paper") {
         console.log( "Rope Wins!");
        } else {
            console.log( "Scissors Wins!");
        }
    }
}

compare(userChoice,computerChoice);


#2

You should use two different arguments because this directly refers to userChoice,secondPlayerChoice , remove the semi colon that comes after the two arguments, also you spelled the word function wrong. You wrote fuction

And then change all of the times you used userChoice,secondPlayerChoice in your function to the two differnt arguments.

Lastly, you need to call your function with the two global variables that you defined

for example if i use x and y as my arguments,

var compare = function(x,y) {

at the end I will call it using the two global variables ,

compare(userChoice,secondPlayerChoice);


#3

Yes I guess I did:) Thanks
I got it fixed
here is the code


#4

Hi.

I would like to give thank to all those people that have helped me with lesson 12.

But now I have a problem with lesson 13, and, instead of opening a new discussion, I have decided to ask for help right here.

I have inserted the code and I always get the same message "Oops, try again.
There was a problem with your syntax.", but I have no idea what I'm doing wrong.

Can you please help me?

The code I've inserted is:

var userChoice = prompt("Do you choose Rock, Paper, Scissors?");
var secondplayerChoice = prompt("What is your choice Second Player");

console.log("First Player Choice:" + userChoice);
console.log("Second Player Choice:" + secondplayerChoice);

var compare = function(firstChoice,secondChoice)

if (firstChoice: === secondChoice){
console.log("The result is a tie!. Please make a new choice...");
}
else{
if (firstChoice === Rock){
if (secondChoice === Paper){
console.log("Paper Wins");
else if (secondChoice === Scissors){
console.log("Rock Wins");
else{
if (firstChoice === Paper){
if (secondChoice === Rock){
console.log("Paper Wins");
else if (secondChoice === Scissors){
console.log("Scissors Wins");
else{
if (firstChoice === Scissors){
if (secondChoice === Rock){
console.log("Rock Wins");
else if (secondChoice === Paper){
console.log("Scissors Wins");
}
}
}
compare(userChoice,secondplayerChoice)

Thank you


#5

Thank you.
I have solved the Problem


#6

Thank you.
I have solved the Problem


#7

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