Build a Rock Paper Scissors Game - Build a Rock Paper Scissors Game

Tell us what’s happening:

I am not able to pass all the tests. Please help me out.
I have tried the code using other compiler and the logic is well thought out. I don’t see any mistake. Thank you

Your code so far

<!-- file: index.html -->
<html lang="en">
<head>
  <script src="script.js"></script>
</head>
</html>
/* file: script.js */
const hand = ['rock', 'paper', 'scissors'];

let humanScore=0;
let computerScore=0;

function getComputerChoice(){
  return hand[Math.floor(Math.random()*3)];
}

function getHumanChoice(){
  let choice = prompt("Rock, Paper or Scissors?");
  return choice;
}

function playRound(humanChoice, computerChoice){
  if(humanChoice === computerChoice){
    return "It's a tie!";
  }
  else if(hand.indexOf(humanChoice)==hand.indexOf(computerChoice)-1 || hand.indexOf(humanChoice)==hand.indexOf(computerChoice)+2){
    computerScore++;
    return `You lose! ${computerChoice} beats ${humanChoice}.`
}
else{
    humanScore++;
    return `You win! ${humanChoice} beats ${computerChoice}.`
}
}

function playGame(){
  for(i=0; i<3; i++){
     playRound(getHumanChoice().toLowerCase(), getComputerChoice());
  }
  if(humanScore>computerScore){
    return "You win the game!" ;
 }else{
   return "You lose the game!";
 }
}

playGame();

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36

Challenge Information:

Build a Rock Paper Scissors Game - Build a Rock Paper Scissors Game

Welcome back to the forum @atreyanischal

Uncaught ReferenceError: i is not defined

You have an undeclared variable.

Happy coding