Need help looping my rock paper scissors progarm

let options = ["rock", "paper", "scissors"];
let player = prompt('Enter rock, paper or scissors', ''.toLowerCase());
let choice;
let results;


function game(){
    gameOne(choice, player);
    
} 

for (let i = 0; i < 5; i++){
    gameOne(choice, player);
    
}

function ComputerPlay(){
choice = options[Math.floor(Math.random()*options.length)];
return choice;
}

function gameOne(playerSelection, computerSelection){
    playerSelection = player;
    computerSelection = ComputerPlay();

     //computer is rock
     if(computerSelection === 'rock' && playerSelection === 'scissors'){
        console.log("You lose, rock beats scissors");
        score
    } 
    else if(computerSelection === 'rock' && playerSelection === 'rock'){
        console.log("Tie");
    }
    else if(computerSelection === 'rock' && playerSelection === 'paper'){
        console.log("You win, paper beats rock");
    }

    //computer is paper
    else if(computerSelection === 'paper' && playerSelection === 'paper'){
        console.log("Tie");
    }
    else if(computerSelection === 'paper' && playerSelection === 'rock'){
        console.log("You lose, paper beats rock");
    }
    else if(computerSelection === 'paper' && playerSelection === 'scissors'){
        console.log("You win, scissors beats paper");
    }

    //computer is scissors
    else if(computerSelection === 'scissors' && playerSelection === 'scissors'){
        console.log("Tie");
    }
    else if(computerSelection === 'scissors' && playerSelection === 'paper'){
        console.log("You lose, scissors beats paper");
    }
    else if(computerSelection === 'scissors' && playerSelection === 'rock'){
        console.log("You win, rock beats scissors");
    }
    else {
        console.log("invalid option");
    }

    return player;
}


game();

Can you point us specifically to what you need help with? You haven’t given us much to go off of.

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