Skip to content

Instantly share code, notes, and snippets.

@RealEmmettS
Created December 7, 2023 00:45
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 RealEmmettS/19a43bcafbd3ac2f0258db56dd9bff86 to your computer and use it in GitHub Desktop.
Save RealEmmettS/19a43bcafbd3ac2f0258db56dd9bff86 to your computer and use it in GitHub Desktop.
// GAME: GUESS THE NUMBER //
// Variable & Requirements Setup //
const prompt = require("prompt-sync")();
let number = 5;
// Game Function //
function runGame(){
let guess = Number.parseInt(prompt("Guess the number: "));
if (guess == number) {
console.log("\n\n-- YOU GOT IT! --\n");
} else {
console.log("Wrong!\n");
runGame();
}
}// End of function runGame() //
// Start of program //
runGame();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment