Skip to content

Commit

Permalink
rock paper scissor update
Browse files Browse the repository at this point in the history
after user testing win color updated on user choices
  • Loading branch information
nitishkhobragade committed Feb 21, 2024
1 parent 80c6dd8 commit dafc527
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion 08_rock_paper_scissors_01/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,35 @@ showWinner = (userWin, userChoice, compChoice) => {
if(userWin) {
console.log("you win!"); // win display in console
userDiv.innerText = `User: ${userChoice}`; //display the slection

compDiv.innerText = `Computer: ${compChoice}`; //display the slection
msg.innerText = `You Win! Your ${userChoice} beats ${compChoice}`; //display result
msg.style.backgroundColor = "green"; //setting backgroind style color of winning
// compDiv.style.backgroundColor = "red";
// userDivstyle.backgroundColor = "green";
userWinCount++;
userScore.innerText = userWinCount;
if(msg.style.backgroundColor === "green"){
compDiv.style.backgroundColor = "red";
userDiv.style.backgroundColor = "green";
};

} else {
console.log("you lose!"); // loose display in console
userDiv.innerText = `User: ${userChoice}`; //display the slection
compDiv.innerText = `Computer: ${compChoice}`; //display the slection
msg.innerText = `You lose. ${compChoice} beats your ${userChoice}`; //display result
msg.style.backgroundColor = "red"; //setting backgroind style color of loosing
// compDiv.style.backgroundColor = "green";
// userDiv.style.backgroundColor = "red";
compWinCount++;
compScore.innerText = compWinCount;
}
if(msg.style.backgroundColor === "red"){
compDiv.style.backgroundColor = "green";
userDiv.style.backgroundColor = "red";
};
};

};

////for tracking which option is clicked
Expand Down

0 comments on commit dafc527

Please sign in to comment.