I am building the rock, paper scissors task. At the minute my code only works for 1 round. I'm unsure about how I would get this to keep the score, whilst repeating for 5 rounds. I'm under the impression i will need a for loop at least for the rounds, along the lines of:
for(i=0; i<5;i++);
but i don't know where to slot it into my code. I've looked around online, and i cant find a simple enough to understand resource that doesn't start using switch methods or any other more advanced code to build the game. Any help would be appreciated. Thanks.
function computerPlay() {
  let random = Math.random();
  if (random <= 0.3333) {
    return "paper";
  } else if (random >= 0.6666) {
    return "rock";
  } else {
    return "scissors";
  }
}
function playRound(playerSelection, computerSelection) {
  if (playerSelection.toLowerCase() === "rock") {
    if (computerSelection === "paper") {
      computerScore++;
      return lose;
    } else if (computerSelection === "rock") {
      return tie;
    } else {
      userScore++;
      return win;
    }
  }
  if (playerSelection.toLowerCase() === "scissors") {
    if (computerSelection === "paper") {
      userScore++;
      return win;
    } else if (computerSelection === "rock") {
      computerScore++;
      return lose;
    } else {
      return tie;
    }
  }
  if (playerSelection.toLowerCase() === "paper") {
    if (computerSelection === "paper") {
      return tie;
    } else if (computerSelection === "rock") {
      userScore++;
      return win;
    } else {
      computerScore++;
      return lose;
    }
  }
}
let userScore = parseInt(0);
let computerScore = parseInt(0);
let win = "You win"
let lose = "You lose"
let tie = "It is a tie"
let playerSelection = prompt("Pick a move");
const computerSelection = computerPlay()
console.log(playRound(playerSelection, computerSelection))
console.log("your score = " + userScore);
console.log("Computer's score = " + computerScore); 
    