Skip to content

Commit

Permalink
Merge pull request #10 from gkumar-pandey/#8-change-text-color
Browse files Browse the repository at this point in the history
style: change text color according to win,loss and draw
  • Loading branch information
uday03meh authored Oct 12, 2022
2 parents 9b111a3 + 23df42e commit a364c6c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ function showResult(scoreBefore, scoreAfter, playerChoice, computerChoice) {

finalresult = document.getElementById("result").innerText;
if (parseInt(scoreBefore) > parseInt(scoreAfter)) {
document.getElementById("result").style.color = "red";
document.getElementById("result").innerText = "You Lose!";
} else if (parseInt(scoreBefore) < parseInt(scoreAfter)) {
document.getElementById("result").style.color = "green";
document.getElementById("result").innerText = "You Won!";
} else {
document.getElementById("result").style.color = "yellow";
document.getElementById("result").innerText = "Draw";
}
}
Expand Down

0 comments on commit a364c6c

Please sign in to comment.