Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created February 10, 2021 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/5cbd98e80882b31749db70ed8202858a to your computer and use it in GitHub Desktop.
Save codecademydev/5cbd98e80882b31749db70ed8202858a to your computer and use it in GitHub Desktop.
Codecademy export
let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;
// Write your code below:
const generateTarget=()=>{
return Math.floor(Math.random() * 9);
}
const compareGuesses=(x,y,z)=>{
var z=generateTarget();
Math.abs(z-x) <= Math.abs(z-y)?true:false;
}
const updateScore=winner=>{
winner ==='human'? humanScore++ : computerScore++;
}
const advanceRound=()=>{
currentRoundNumber++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment