UNPKG

typescript-nodeprojects-number-guessing-game

Version:

This TypeScript code implements a simple command-line number guessing game called 'Artificialvolutionize'. It provides a fun and interactive way to test your luck and guessing skills.

23 lines (17 loc) 581 B
#! /usr/bin/env node import inquirer from "inquirer"; console.log("\n\tWellcome to Artificialvolutionize - CLI Number Guessing Game\n"); const randomNumber = Math.floor(Math.random() * 5 + 1); const answer = await inquirer.prompt([ { name: "userGuessedNumber", type: "number", message: "Enter your guess number(Number Limit from 1 to 5):", }, ]); if (answer.userGuessedNumber === randomNumber){ console.log("Congratulation ! You guess a correct number."); } else{ console.log("Sorry, you guess a wrong number"); }