-
-
Save codecademydev/a6073f8d576eb07c2271ef45443695dc to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let humanScore = 0; | |
let computerScore = 0; | |
let currentRoundNumber = 1; | |
// Write your code below: | |
const generateTarget = () => Math.floor(Math.random())* 10; | |
const compareGuesses = (human, computer, target) => { | |
const humanWin = true; | |
const computerWin = false; | |
if (human === computer) { | |
return "It's a tie!"; | |
} | |
else if (human > computer) { | |
return humanWin(); | |
} | |
else if (human < computer) { | |
return computerWin(); | |
} | |
}; | |
const updateScore = winner => { | |
const score = (humanScore, computerScore) => { | |
if (humanWin) { | |
console.log(humanscore ++ 1); | |
} | |
else if (computerWin) { | |
console.log(computerScore ++ 1); | |
} | |
}; | |
const advanceRound = () => { | |
currentRoundNumber (++ 1); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment