-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
163 lines (149 loc) · 3.98 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
var chalk = require('chalk');
var readlineSync = require('readline-sync');
var userName = readlineSync.question(chalk.yellow('Welcome to the Naruto Quiz App! What is your name? '))
var HighestScore = {name: "Rahul" , score: "140"}
var score = 0;
console.log(chalk.green("Hi " + userName + "!"))
console.log(chalk.red("let's start the quiz! Remember that for each right answer you will be awarded 10 points and for the wrong answer -5"))
readlineSync.question(chalk.blue('Press Enter to start when You are Ready!!'))
function play(question, answer) {
var userAnswer = readlineSync.question(question);
if(userAnswer.toUpperCase() === answer.toUpperCase()){
console.log(chalk.green("You are right!"))
score += 10
}else {
console.log(chalk.red("You are Wrong!"));
score -= 5;
}
console.log(chalk.bold("Your Score is.. "+ score))
console.log("......................")
}
var Allquestions = [{
question: `What is the Hair color of Naruto ?
a. Black
b. yellow
c. red
Ans. ` ,
answer: "b"
},
{
question: `Which Hokage sealed the nine-tailed fox inside Naruto?
a. first Hokage
b. second Hokage
c. Fourth Hokage
Ans. ` ,
answer: "c"
},
{
question: `Which character can only use taijutsu ?
a. rocklee
b. Gara
c. Sasuki Uchiha
Ans. ` ,
answer: "a"
},
{
question: ` Sasuke's goal is gain enough power to kill whom?
a. Naruto
b. Kakashi
c. Itachi Uchiha
Ans. ` ,
answer: "c"
},
{
question: `What does 'Chidori' mean?
a. one thousand birds
b. five thousand swords
c. ten thousand stones
Ans. ` ,
answer: "a"
},
{
question: `Which of the legendary sannin becomes the fifth Hokage ?
a. Tsunade
b. Jiraya
c. Orochimaru
Ans. ` ,
answer: "a"
},
{
question: `D-rank missions are usually given to what level of shinobi ?
a. Chunin
b. Genin
c. Hokage
Ans. ` ,
answer: "b"
},
{
question: `Which of the following ninjas is a kunoichi?
a. Orochimaru
b. Naruto Uzumaki
c. Sakura Haruno
Ans. ` ,
answer: "c"
},
{
question: `What is the relationship between Naruto and Iruka?
a. Their parents were killed when they were younger
b. Iruka was Naruto's teacher
c. All of these
Ans. ` ,
answer: "c"
},
{
question: `What is the forbidden technique used by Rock Lee that he used on Dosu and Gaara?
a. Lotus of Destruction
b. Fiery Lotus
c. Primary Lotus
Ans. ` ,
answer: "a"
},
{
question: `Who tricked Naruto into stealing a sacred scroll?
a. Mizuki
b. Sasuke
c. Zabuza
Ans. ` ,
answer: "a"
},
{
question: `What is Naruto's last name?
a. Shippuden
b. Uzumaki
c. He doesnt have one
Ans. ` ,
answer: "b"
},
{
question: `Which famed clan was completely massacred?
a. Uchiha
b. Uzumaki
c. Hyugaa
Ans. ` ,
answer: "a"
},
{
question: `Which of these is NOT one of Naruto's specialties?
a. Shadow clone jutsu
b. Chidori
c. Rasengan
Ans. ` ,
answer: "b"
},
{
question: `Whom does Sakura love?
a. Naruto
b. Gaara
c. Sasuke
Ans. ` ,
answer: "c"
},]
for (var i = 0; i < Allquestions.length ; i++){
var currentQuestion = Allquestions[i]
play(currentQuestion.question,
currentQuestion.answer)
}
if(HighestScore.score < score){
console.log(chalk.red("Congrats! You have beaten the Highest Scorer.... send me the screen shot so that I may update your Name"))
}
console.log(chalk.green("Your HighestScore is... " + score))