I’m working on the Number Guesser project but I’m not sure what I’m supposed to do because it seems the game.js does much of it.
In the instructions, it says we don’t need to look at the game.js code. I assumed the game.js was handling additional things that made the game work. But the game.js it has this code:
// Generate the target value
target = generateTarget();
// Retrieve the player's guess
const currentHumanGuess = humanGuessInput.value;
// Make a random 'computer guess'
const computerGuess = Math.floor(Math.random() * 10);
// Display the computer guess and the target
computerGuessDisplay.innerText = computerGuess;
targetNumberDisplay.innerText = target;
// Determine if the human or computer wins:
const humanIsWinner = compareGuesses(currentHumanGuess, computerGuess, target)
const winner = humanIsWinner ? 'human' : 'computer'
Is this code doing what the project is asking me to do? Is the game.js the “solution code”?
If not, it seems almost harder to “see” the entire code because I feel like I’m only coding half of it. For example, I was going to write code to generate the computer’s guess, but the game.js contains the code const computerGuess = Math.floor(Math.random() * 10);
So I’m guessing I don’t need to do that. Is there a link to a video if (when) I get stuck to walk me through it? Thanks