rahi123-number-guessing-game
v1.0.2
Published
import inquirer from "inquirer"
Downloads
3
Readme
cli--number-guessing-game
#! /user/bin/enve node import inquirer from "inquirer"
// 1)computer will generate a random number
// 2) use input a guessing number
// 3) compare user input with computer generated number and show result - done
const randomNumber = Math.floor(Math.random() *6 + 1);
const answer = await inquirer.prompt([ { name: "useGuessNumber", type: "number", message: "please guess a number between 1-10: ", }, ]); if (answer.userGuessedNumber === randomNumber) { console.log("congratulations! you guessed a right number,"); } else { console.log("You guessed a wrong number"); }