I just started learning JavaScript and I am trying to improve a "Rock, Scissors, Paper" game I built(see code below).

I try to build the game without the last function, input(). But I learnt that I can only use "return" in a function. When I print the function using console.log() it worked without the input() function. 

I want to learn how I can do this making use of the input() function and as well as be able to call the gamePlay() inside the input(). Any help will be appreciated.

```
var gamePlay = function (userGameChoice) {
    var computerChoice = Math.random(0, 1);
    if (computerChoice < 0.34) {
        computerChoice = "rock";
    } else if (computerChoice <= 0.67) {
        computerChoice = "paper";
    } else {
        computerChoice = "scissors";
    }
    var compare = function (choice1, choice2) {
        if (choice1 === choice2) {
            return "The result is a tie!";
        }
        if (choice1 === "rock") {
            if (choice2 === "scissors") {
                return "rock wins";
            } else {
                return "paper wins";
            }
        }
        if (choice1 === "paper") {
            if (choice2 === "rock") {
                return "paper wins";
            } else {
                return "scissors wins";
            }
        }
        if (choice1 === "scissors") {
            if (choice2 === "rock") {
                return " rock wins";
            } else {
                return "scissors wins"
            }
        }
    }

    compare(userGameChoice, computerChoice);

}

var input = function (userChoice) {
    if (userChoice === "rock") {
        return gamePlay("rock");
    } else if (userChoice === "paper") {
        return gamePlay("paper");
    } else if (userChoice === "scissors") {
        return gamePlay("scissors");
    } else {
        return "Invalid input";
    }
}
input(prompt("Do you choose rock, paper or scissors?"));

```