-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
24 lines (24 loc) · 1.03 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env node
import inquirer from "inquirer";
import chalk from "chalk";
import showBanner from "node-banner";
import chalkAnimation from 'chalk-animation';
(async () => {
await showBanner('G u e s s a N u m ber', '\t \t \t Between 1 to 6 \n', 'green', 'blue');
const randomNumber = Math.floor(Math.random() * 6 + 1);
console.log('answer to cheat 🤫: ', randomNumber);
const answer = await inquirer.prompt([
{
name: "userGuessedNumber",
type: "number",
message: chalkAnimation.rainbow("\t Please Guess a number between 1 to 6 :\t \n "),
},
]);
console.log(chalk.bgWhiteBright(chalk.black.bold('You Enter')), answer.userGuessedNumber);
if (answer.userGuessedNumber === randomNumber) {
console.log(chalk.rgb(242, 11, 151).bold.italic("congratulation!🎉✨"), chalk.rgb(242, 158, 200)('you guessed the right number.🎊'));
}
else {
console.log(chalk.rgb(242, 0, 0).bold.italic("you guessed the wrong number") + '😢😢😢');
}
})();