Skip to content

Commit a4fe002

Browse files
author
Maftuna Avazova
committed
Lesson 4: readline Practice
1 parent 16b4e4c commit a4fe002

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

practice radline/Question.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
Instructions
3+
4+
Create a command-line quiz application that tests students on knowledge from the
5+
Values, Data Types, and Operations module.
6+
7+
Your application should:
8+
1. Use the readline-sync node module to ask users questions and collect their
9+
responses.
10+
2. Prompt the user for their name and greet them.
11+
3. Use readline-sync.question() to ask the user 5 questions that test their
12+
knowledge of Values, Data Types, and Operations.
13+
- At least one of your questions should prompt the user for a number.
14+
4. Store the user’s answers in variables.
15+
5. Print the value of those answers back to the user.
16+
Setup
17+
1. Make sure you install readline-sync following the instructions in the
18+
Lesson: Values, Data Types, and Operations - 4.
19+
2. For this activity, you will create your own repository to store your code:
20+
1. Create a new repository.
21+
2. Name it: practice-readline-sync-[Your First Name]-[Your Last Initial]
22+
3. Make sure the repository is public.
23+
4. Clone the repository to your local machine.
24+
5. Start working on the code.
25+
6. When you are finished, commit your changes and push them to your
26+
repository.
27+
*/
28+
29+
//Write your code below//
30+
31+
const readlineSync = require('readline-sync');
32+
33+
34+
const questionOne = readlineSync.question('What is the result of 5 + 3? ');
35+
const questionTwo = readlineSync.question('What data type is "Hello, World!"? ');
36+
const questionThree = readlineSync.question('What keyword is used to declare a variable in JavaScript?');
37+
const questionFour = readlineSync.question('What is the result of 10 / 2? ');
38+
const questionFive = readlineSync.question('Which symbol is used for single-line comments in JavaScript? ');
39+
40+
const anwerQuestionOne = questionOne;
41+
const anwerQuestionTwo = questionTwo;
42+
const anwerQuestionThree = questionThree;
43+
const anwerQuestionFour = questionFour;
44+
const anwerQuestionFive = questionFive;
45+
46+
console.log("Here are your answers:");
47+
console.log(`1. Answer to Question One: ${anwerQuestionOne}`);
48+
console.log(`2. Answer to Question Two: ${anwerQuestionTwo}`);
49+
console.log(`3. Answer to Question Three: ${anwerQuestionThree}`);
50+
console.log(`4. Answer to Question Four: ${anwerQuestionFour}`);
51+
console.log(`5. Answer to Question Five: ${anwerQuestionFive}`);
52+
53+
54+
55+
56+
57+
58+

0 commit comments

Comments
 (0)