-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
57 lines (46 loc) · 1.47 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>m1repo</title>
</head>
<body>
var score= 0
var readlineSync=require('readline-sync')
var userName = readlineSync.question("what is your name ? ")
console.log("welcome "+userName+", lets play do u know shabash ? ")
function play (question,answer){
var userAnswer = readlineSync.question(question)
if(userAnswer.toUpperCase()===answer.toUpperCase()){
console.log("u are right")
score= score+1;
}else{
console.log("u are wrong")
}
}
var questions = [
questionOne = {question: "What is his age? ", answer: "22"},
questionTwo = {question: "where did he went for school? ", answer: "james"},
questionThree = {question: "where did he went for college? ", answer: "saranathan"}
]
for (i=0; i<questions.length; i++){
var currentQuestion=questions[i]
play (currentQuestion.question,currentQuestion.answer)
}
console.log("your score is: ",score)
//data of high score
var highScore = [{name:"shabash",
score:3},
{name:"rifa",
score:2}]
console.log("highScores are:")
for (i=0; i<highScore.length; i++){
currentHighScore= highScore[i]
console.log(currentHighScore.name)
console.log(currentHighScore.score)
console.log("-----")
}
</body>
</html>