JS Intro to Function 13. Conclusion ( rock paper scissors game )


#1

var game = function(number) {

var rock = 5;
var paper = 6;
var scissors = 7;

    if (rock < paper) 
        return ("Rock Wins!");

       (paper < scissors) 
        return ("Scissors Wins!");

        ( scissors < rock )
       return ("Rock wins!");

                 };

#2

do you have a question?


#3

hi rydan, I tried above, but I don't know how to call this function... thanks


#4

according to the function definition, it takes in one argument(expected to be an integer). To call it you do

game(6);

but you can also log the result of calling it to console like this

console.log(game(6));

#5

genius, thank you so much rydan!! but I am not sure if I have written the code correctly as per spec... moving on the next lessons, started to make !