This will be the first blog of my life, where I would be trying to explain, how I created my first CLI ( Command-line interface ) project named HOW WELL DO YOU KNOW MY FRIEND?
Project Introduction:
A game built using CLI with JavaScript language for fun. The game asks you some basics questions about me. if you give the correct answer, then your score will increase by 1 in every correct answer and if your answer will wrong your score will decrease by 1.
- readlineSync
- chalk
The first one is used for asking questions with users via console, and the other is used for styling.
Technologies used:
replit.it : A online code editor (IDE) used for executed the javaScript code.
JavaScript programming language
Explanation:
This project is divided into some steps.
Step1:
Install readlineSync and chak packages.
Step2:
Create an array of objects, where your all questions and answers would be store.
var quizs = [{question: "", answer: ""}]
Step3:
Create a function with two parameter, one is for questions and the other is for answers.
function askQuestion(myQuestions, myAnswers){}
Step4:
The created functions invoked inside a for loop (for loop is a way to execute code repeatedly.)
Step5:
This is the last step of this project, where your function is executed.
Github
Live
Hope you like it! My first blog...I'll improve it day by day.