-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmark-1.js
63 lines (54 loc) · 1.31 KB
/
mark-1.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
var readlineSync=require('readline-sync')
var score=0
var userName= readlineSync.question('Enter your Name: ')
console.log('Hello '+userName)
function play(question,answer){
var userAnswer=readlineSync.question(question)
if (userAnswer===answer){
console.log("Right Answer.\n")
score++
console.log("Your score is :",score)
}
else{
console.log("Wrong Answer!\n")
console.log("Your score is :",score)
}
}
const highScore=[{
name:'Ashif',
score:'5'
},{
name:'faiz',
score:'4'
}
]
var ashifQuestion=[{
question:"Do you know Ashif?",
answer:"yes"
},
{
question:"What is Ashif's Hometown?",
answer: "lucknow"
},
{
question:"Who is Ashif's fav Superhero?",
answer:"iron man"
},{
question:"What is Ashif's Hobby?",
answer:"writing"
},{
question:"Ashif's fav color?",
answer:'black'
}
]
for (i=0;i<ashifQuestion.length;i++){
var questionCount=ashifQuestion[i]
play(questionCount.question,questionCount.answer)
}
console.log("Your total score is: ",score)
console.log("Check out the high scores, if you should be there send me a screenshot and I'll update it:")
for (i=0;i<highScore.length;i++){
var highscoreName=highScore[i].name
var highScored=highScore[i].score
console.log(highscoreName,highScored)
}