Created
December 7, 2023 00:45
-
-
Save RealEmmettS/19a43bcafbd3ac2f0258db56dd9bff86 to your computer and use it in GitHub Desktop.
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
// 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