Help, How do I create a Scoreboard in Java

I need to create a scoreboard in Java and I don’t know how or where to add it, please help. This is my code where it needs to be added somewhere. This is a rock, paper, scissors game

function updateScores(winner) {

if (winner==“Human”) {

humanScore = humanScore + 1

document.getElementById(“human-score”).innerHTML = "Score: " + humanScore;


else if (winner == “Computer”) {

computerScore = computerScore + 1

document.getElementById(“computer-score”). innerHTML = "Score: " + computerScore;


i found some links that might be able to help you

thank you for the help but I just don’t understand what to add and where to add it, I have tried these methods and they don’t work.

Hi @MeMyselfandI , welcome to the forum.
Unfortunately, without more information it’s a bit difficult to help you. We are lacking the context in which you are calling that function. But, I guess, you’d call it whenever one of the players score a point.

I suggest you to put your code (html, CSS and JavaScript) in a codepen project or a jsfiddle and than share it with us. That way we’ll be able to help you.

Also note that Java is different than JavaScript. What you are using is JavaScript.

Here is the link

The basicComputerPlayer function needs to return the random number. Its function definition also has a parameter (basicComputerPlayerChoice) that isn’t being used.

// Call site of basicComputerPlayer, the function should return the value to be captured
var computerPlayerChoice = basicComputerPlayer();

// The return value is used here
var winner = checkWinner(humanPlayerChoice, computerPlayerChoice);

function basicComputerPlayer() {
  ...start of code
  // return the value so it can be captured at the call site
  return randomNumber;

where should I add it?

At the bottom of the basicComputerPlayer function add return randomNumber;