Number guesser

very first project. any help will be very much appreciated.

Hi there, and welcome to the forums. :slight_smile:

That doesn’t look quite finished to me - is there a specific step where you’re stuck? (If so, can you also post a link to the project on Codecademy please?)

1 Like

have just completed it but I lost the link to the project

I have created project but when I go to next round - the next round button become deactivated. Any ideas why?

I wrote my code out, but when I try it out the “Next” button doesn’t work so I only only do one round, and I’m not getting any errors in the debugger. I tried looking online, but my code look similar to what I have. Does anyone have an ideas as to what I am doing wrong?

let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;

// Write your code below:

const generateTarget = () =>{
let secret = Math.floor(Math.random() * 10);
return secret
}

const compareGuesses = (human, computer, secret) =>{
let h1 = Math.abs(human - secret)
let c1 = Math.abs(computer - secret)
if (human >= 9 || human <= 0){
alert ‘Please select a number from 1 - 9’
}

if (h1 < c1 || h1 === c1 ){
return true;}
else if (c1 < h1){
return false;}
}

const updateScore = winner => {
if (winner === ‘human’) {
humanScore += 1;}
else if (winner === ‘computer’){
computerScore = computerScore + 1
}
}

const advancedRound = () => {
currentRoundNumber += 1;
};

‘Advanced’ is an adjective; ‘advance’ is a verb. What is the name of the function that game.js calls for this event?

Thanks, yes I keep changing the names when I don’t mean to. Good eye!

1 Like