-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
672 lines (614 loc) · 26.7 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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Group Date Cafe Quiz</title>
</head>
<body>
<div id="quiz-container">
<div id="question"></div>
<div id="answers"></div>
<div id="result"></div>
</div>
<script>
const questionGroups = {
starter: {
questionText: "Does a difference in age or sex not matter as long as there is love?",
answers: [
{ text: "Their sex matters", group: "group2A" },
{ text: "It doesn't matter at all!", group: "group2B" }
]
},
group2A: [
{
questionText: "What's your idea of a good time together?",
answers: [
{ text: "Definitely outdoors!", group: "group3" },
{ text: "Positively indoors!", group: "group1" }
]
}
],
group2B: [
{
questionText: "How do you want the person you like to act towards you?",
answers: [
{ text: "Make a bold move on me", group: "group2" },
{ text: "Make a modest move on me", group: "group4" }
]
}
],
group1: [
{
questionText: "What kind of club would you be interested in joining?",
answers: [
{ text: "The Gardening Club", person: null },
{ text: "The Diving Club", person: null },
{ text: "The Technology Club", person: "Fuuka Yamagishi" }
]
},
{
questionText: "What kind of older lady do you like?",
answers: [
{ text: "One talented at lame jokes", person: "Margaret" },
{ text: "One good at looking after others", person: null },
{ text: "One who's actually an older man", person: null }
]
},
{
questionText: "That girl you're curious about dropped something. What was it?",
answers: [
{ text: "A floral-pattern handkerchief", person: null },
{ text: "A lacy parasol", person: null },
{ text: "Some handwritten poetry", person: "Marie" }
]
},
{
questionText: "What surprised you about the one you fell in love with?",
answers: [
{ text: "They're a crane, not a human", person: null },
{ text: "They're a girl, not a prince", person: "Naoto Shirogane" }
]
},
{
questionText: "What do you live on?",
answers: [
{ text: "Rice", person: null },
{ text: "Bread", person: null },
{ text: "Donuts", person: "Rei" }
]
},
{
questionText: "Where would you go to soothe your weary soul?",
answers: [
{ text: "A hot springs inn", person: "Yukiko Amagi" },
{ text: "An extravagant resort", person: null },
{ text: "A mountain cabin", person: null }
]
},
],
group2: [
{
questionText: "What's the number one topping for beef bowls?",
answers: [
{ text: "Red pickled ginger", person: null },
{ text: "Protein", person: "Akihiko Sanada" },
{ text: "Green onions", person: null }
]
},
{
questionText: "All together now:",
answers: [
{ text: "\"Let's go have some fun!\"", person: null },
{ text: "\"Even the ace detective gives up!\"", person: "Junpei Iori" }
]
},
{
questionText: "What's the most important accompaniment for food?",
answers: [
{ text: "A tall glass of milk", person: "Ken Amada" },
{ text: "Warm green tea", person: null },
{ text: "Mad Bull", person: null },
{ text: "Someone to eat with", person: null }
]
},
{
questionText: "What do you most seek comfort in?",
answers: [
{ text: "Relaxing music", person: null },
{ text: "Massages", person: null },
{ text: "Squishy dog pads", person: "Koromaru" }
]
},
{
questionText: "What's in your refrigerator?",
answers: [
{ text: "Dinner leftovers", person: null },
{ text: "Cold barley tea", person: null },
{ text: "Some kind of grass", person: "Yu Narukami" }
]
},
{
questionText: "What is the primary characteristic of a cute girl?",
answers: [
{ text: "A lovely smile", person: null },
{ text: "She wears glasses", person: null },
{ text: "Makes bear puns", person: "Teddie" }
]
},
],
group3: [
{
questionText: "Which would you choose?",
answers: [
{ text: "The Voluptuous Abaddon", person: null },
{ text: "A titanium-bodied beauty", person: "Aigis" }
]
},
{
questionText: "You're feeling a bit hungry... What do you reach for?",
answers: [
{ text: "A rice ball", person: null },
{ text: "Meat gum", person: "Chie Satonaka" }
]
},
{
questionText: "What makes her charming?",
answers: [
{ text: "The way she runs up an escalator", person: "Elizabeth" },
{ text: "The way animals eat her food scraps", person: null },
{ text: "Her taking home my electronics", person: null }
]
},
{
questionText: "Someone you like gave you a compliment. What did they say?",
answers: [
{ text: "You're amazing!", person: null },
{ text: "You're so cool!", person: null },
{ text: "C'est magnifique!", person: "Mitsuru Kirijo" }
]
},
{
questionText: "What do you like to do to liven things up?",
answers: [
{ text: "Play King's Game at a club", person: "Rise Kujikawa" },
{ text: "Singing contests at karaoke", person: null },
{ text: "Arcade tournaments", person: null },
{ text: "Read at a library", person: null }
]
},
{
questionText: "If you were going to master something, it'd definitely be this!",
answers: [
{ text: "Calligraphy", person: null },
{ text: "Flower arrangement", person: null },
{ text: "Archery", person: "Yukari Takeba" }
]
},
],
group4: [
{
questionText: "What is the best place for some alone time?",
answers: [
{ text: "Relaxing at a cafe", person: null },
{ text: "A thrilling amusement park", person: null },
{ text: "Hands-on at a bath house", person: "Kanji Tatsumi" }
]
},
{
questionText: "Are you starting to get tired of these questions?",
answers: [
{ text: "Not really", person: null },
{ text: "Maybe", person: null },
{ text: "I don't care", person: "Makoto Yuki" }
]
},
{
questionText: "What movies make you cry?",
answers: [
{ text: "War films", person: null },
{ text: "Tragic romances", person: null },
{ text: "Incredible Pet Stories", person: "Shinjiro Aragaki" }
]
},
{
questionText: "If you could be reborn into another family, what would your role be?",
answers: [
{ text: "Older brother to sisters", person: null },
{ text: "Younger brother of sisters", person: "Theodore" },
{ text: "A trustworthy sister", person: null }
]
},
{
questionText: "How would you express your feelings to the one you like?",
answers: [
{ text: "Tell them in person", person: null },
{ text: "Slug it out at a riverbed", person: "Yosuke Hanamura" },
{ text: "Something else...", person: null }
]
},
{
questionText: "Oh no! Your beloved is in danger!",
answers: [
{ text: "Rush over at once", person: null },
{ text: "Level your bowgun", person: "Zen" },
{ text: "Stand back and watch", person: null }
]
},
],
randomQuestions: [
{
questionText: "You've upset your beloved! How will you make it up to them?",
answers: [
{ text: "Apologize profusely", group: "random" },
{ text: "Butter them up with gifts", group: "random" },
{ text: "Get angry and dodge the issue", group: "random" }
]
},
{
questionText: "In your next life, would you rather be a man or a woman?",
answers: [
{ text: "Definitely a Man", group: "random" },
{ text: "A woman, obviously", group: "random" }
]
},
{
questionText: "Which would you rather be inside?",
answers: [
{ text: "A shark tank", group: "random" },
{ text: "A lion cage", group: "random" }
]
},
{
questionText: "Clothing, food, or housing: which would you spend money on first?",
answers: [
{ text: "Definitely clothing", group: "random" },
{ text: "Positively food", group: "random" },
{ text: "Absolutely housing", group: "random" }
]
},
{
questionText: "If you had to eat one or the other, which would it be?",
answers: [
{ text: "A plate of wasabi", group: "random" },
{ text: "A plate of sugar", group: "random" }
]
},
{
questionText: "Which kind of prize would you want to win?",
answers: [
{ text: "One gigantic one", group: "random" },
{ text: "Recurring small prizes", group: "random" }
]
},
{
questionText: "What's the first thing you get in line for at the amusement park?",
answers: [
{ text: "Screaming roller coasters", group: "random" },
{ text: "Romantic merry-go-rounds", group: "random" },
{ text: "Whirling tea cups", group: "random" }
]
},
{
questionText: "What is your greatest weapon?",
answers: [
{ text: "My dazzling smile", group: "random" },
{ text: "My passionate eyes", group: "random" },
{ text: "My conversational skills", group: "random" },
{ text: "My pure heart", group: "random" }
]
},
{
questionText: "What do you do if someone you don't care for confesses their love?",
answers: [
{ text: "Might as well date them", group: "random" },
{ text: "Start by being friends", group: "random" },
{ text: "Hesitantly turn them down", group: "random" },
{ text: "Bluntly reject them", group: "random" }
]
},
{
questionText: "Your specialty dish is...",
answers: [
{ text: "Curry", group: "random" },
{ text: "Meat and potatoes", group: "random" },
{ text: "Pickled mackerel", group: "random" }
]
}
]
};
let currentGroupKey = 'starter';
let askedQuestions = new Set();
let finalCharacter = '';
let questionCount = 0;
const totalQuestions = 10;
function displayQuestion() {
if (questionCount >= totalQuestions) {
displayFinalOutput();
return;
}
questionCount++;
updateQuestionCounter();
const group = questionGroups[currentGroupKey];
let questionData;
if (finalCharacter || currentGroupKey === 'randomQuestions') {
questionData = getQuestionFromGroup('randomQuestions');
} else {
questionData = getQuestionFromGroup(currentGroupKey);
}
if (!questionData) {
displayFinalOutput();
return;
}
const questionContainer = document.getElementById('question');
const answersContainer = document.getElementById('answers');
questionContainer.innerHTML = `<h2>${questionData.questionText}</h2>`;
answersContainer.innerHTML = ''; // Clear previous answers
// Create buttons for each answer and attach event listeners
questionData.answers.forEach(answer => {
const button = document.createElement('button');
button.textContent = answer.text;
button.addEventListener('click', () => handleAnswer(answer));
answersContainer.appendChild(button);
});
}
function handleAnswer(answer) {
if (answer.text === "Something else..." && questionCount == 9) {
// Update currentGroupKey if necessary or perform other actions before displaying Question 10
displayQuestion10(); // Call the function to display Question 10
return; // Exit the function to avoid further actions
}
if (answer.group) {
currentGroupKey = answer.group;
} else if (answer.person) {
finalCharacter = answer.person;
currentGroupKey = 'randomQuestions'; // Switch to random questions after determining finalCharacter
}
displayQuestion();
}
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]]; // Swap elements
}
}
function getQuestionFromGroup(groupKey) {
let group = questionGroups[groupKey];
let questionData;
// Shuffle the questions if the group is an array and not the starter group
if (Array.isArray(group) && groupKey !== 'starter') {
shuffleArray(group);
}
if (Array.isArray(group)) {
// Find the first question that hasn't been asked yet
questionData = group.find(q => !askedQuestions.has(q.questionText));
// If a question is found, mark it as asked
if (questionData) askedQuestions.add(questionData.questionText);
} else if (!askedQuestions.has(group.questionText)) {
questionData = group;
askedQuestions.add(group.questionText);
}
return questionData;
}
function updateQuestionCounter() {
document.getElementById('question-counter').innerText = `Question ${questionCount} of ${totalQuestions}`;
}
const characterImageMap = {
"Fuuka Yamagishi": ["images/Fuuka_Yamagishi.gif", "images/Fuuka_Yamagishi.png", "images/Fuuka_Yamagishi.jpeg", "images/Fuuka_Yamagishi.jpg", "images/Fuuka_Yamagishi_1.jpg", "images/Fuuka_Yamagishi_1.png", "images/Fuuka_Yamagishi_1.gif"],
"Margaret": ["images/Margaret.png"],
"Marie": ["images/Marie.jpg"],
"Naoto Shirogane": ["images/Naoto_Shirogane.jpg", "images/Naoto_Shirogane.png", "images/Naoto_Shirogane.jpeg"],
"Rei": ["images/Rei.webp"],
"Yukiko Amagi": ["images/Yukiko_Amagi.jpg", "images/Yukiko_Amagi_1.jpg"],
"Akihiko Sanada": ["images/Akihiko_Sanada.jpg", "images/Akihiko_Sanada.jpeg", "images/Akihiko_Sanada_1.jpeg", "images/Akihiko_Sanada.png"],
"Junpei Iori": ["images/Junpei_Iori.png", "images/Junpei_Iori_1.png", "images/Junpei_Iori.jpg", "images/Junpei_Iori_2.png", "images/Junpei_Iori_1.jpg", "images/Junpei_Iori.jpeg", "images/Junpei_Iori_3.png"],
"Ken Amada": ["images/Ken_Amada.png", "images/Ken_Amada.jpg", "images/Ken_Amada_1.jpg"],
"Koromaru": ["images/Koromaru.jpg", "images/Koromaru.png"],
"Yu Narukami": ["images/Yu_Narukami.png", "images/Yu_Narukami_1.png", "images/Yu_Narukami.jpg", "images/Yu_Narukami_1.jpg"],
"Teddie": ["images/Teddie.jpg", "images/Teddie.jpeg"],
"Aigis": ["images/Aigis.png", "images/Aigis_1.png", "images/Aigis_2.png", "images/Aigis.jpg", "images/Aigis_3.png", "images/Aigis_4.png"],
"Chie Satonaka": ["images/Chie_Satonaka.jpg", "images/Chie_Satonaka_1.jpg"],
"Elizabeth": ["images/Elizabeth.jpg"],
"Mitsuru Kirijo": ["images/Mitsuru_Kirijo.jpg", "images/Mitsuru_Kirijo_1.jpg"],
"Rise Kujikawa": ["images/Rise_Kujikawa.jpg", "images/Rise_Kujikawa.png", "images/Rise_Kujikawa_1.jpg", "images/Rise_Kujikawa_2.jpg"],
"Yukari Takeba": ["images/Yukari_Takeba.jpg"],
"Kanji Tatsumi": ["images/Kanji_Tatsumi.jpg", "images/Kanji_Tatsumi_1.jpg"],
"Makoto Yuki": ["images/Makoto_Yuki.gif", "images/Makoto_Yuki.jpg", "images/Makoto_Yuki_1.jpg", "images/Makoto_Yuki_2.jpg"],
"Shinjiro Aragaki": ["images/Shinjiro_Aragaki.png", "images/Shinjiro_Aragaki_1.png", "images/Shinjiro_Aragaki.jpg"],
"Theodore": ["images/Theodore.jpeg"],
"Zen": ["images/Zen.png"],
"Yosuke Hanamura": ["images/Yosuke_Hanamura.png", "images/Yosuke_Hanamura.webp", "images/Yosuke_Hanamura.gif", "images/Yosuke_Hanamura.jpg", "images/Yosuke_Hanamura_1.png", "images/Yosuke_Hanamura_1.jpg"]
};
function displayFinalOutput() {
if (!finalCharacter && questionCount < 10) {
// Directly specify what to display for question 9 based on currentGroupKey
let questionText = '';
let answers = [];
// Setup for question 9 display
if (currentGroupKey.startsWith('group1')) {
questionText = "What you look for in a woman is...";
answers = [
{ text: "A keen-eyed, shy Japanese girl", person: "Yukiko Amagi" },
{ text: "A sensitive, literary sort", person: "Marie" },
{ text: "Someone mysterious in a sleek car", person: "Margaret" },
{ text: "Something else...", person: null }
];
} else if (currentGroupKey.startsWith('group2')) {
questionText = "What you look for in a man is...";
answers = [
{ text: "A great sense of humor", person: "Junpei Iori" },
{ text: "Well-honed muscles", person: "Akihiko Sanada" },
{ text: "Rock-solid reliability", person: "Yu Narukami" },
{ text: "Something else...", person: null }
];
} else if (currentGroupKey.startsWith('group3')) {
questionText = "What you look for in a woman is...";
answers = [
{ text: "Brains and beauty", person: "Mitsuru Kirijo" },
{ text: "An invincible idol smile", person: "Rise Kujikawa" },
{ text: "Polite and proper behaviour", person: "Elizabeth" },
{ text: "Something else...", person: null }
];
} else if (currentGroupKey.startsWith('group4')) {
questionText = "What you look for in a man is...";
answers = [
{ text: "A motherly, caring side", person: "Shinjiro Aragaki" },
{ text: "A cool, but wild side", person: "Makoto Yuki" },
{ text: "Skilled hands", person: "Kanji Tatsumi" },
{ text: "Something else...", person: null }
];
}
// If question 9 was specifically set for this group, display it
if (questionText && answers.length > 0) {
const questionContainer = document.getElementById('question');
const answersContainer = document.getElementById('answers');
questionContainer.innerHTML = `<h2>${questionText}</h2>`;
answersContainer.innerHTML = ''; // Clear previous answers
// Populate the answers
answers.forEach(answer => {
const button = document.createElement('button');
button.textContent = answer.text;
button.addEventListener('click', () => handleAnswer(answer));
answersContainer.appendChild(button);
});
// Ensure questionCount reflects showing question 9
questionCount = 9;
}
return;
}
if (!finalCharacter && questionCount == 9) {
let questionText10 = '';
let answers10 = [];
// Assuming 'groupXNineTen' is correctly set when moving to Question 10
if (currentGroupKey.endsWith('NineTen')) {
if (currentGroupKey.startsWith('group1NineTen')) {
questionText10 = "What kind of girl makes your heart skip a beat?";
answers10 = [
{ text: "Someone reserved and considerate", person: "Fuuka Yamagishi" },
{ text: "Overwhelming intellect", person: "Naoto Shirogane" },
{ text: "A healthy appetite", person: "Rei" },
];
} // Replicate for 'group2NineTen', 'group3NineTen', and 'group4NineTen'
if (questionText && answers.length > 0) {
const questionContainer = document.getElementById('question');
const answersContainer = document.getElementById('answers');
questionContainer.innerHTML = `<h2>${questionText}</h2>`;
answersContainer.innerHTML = ''; // Clear previous answers
// Populate the answers
answers.forEach(answer => {
const button = document.createElement('button');
button.textContent = answer.text;
button.addEventListener('click', () => handleAnswer(answer));
answersContainer.appendChild(button);
});
questionCount = 10; // Correctly increment questionCount
}
}
}
// Update the question counter to show "Final Result" surrounded by heart emojis
const questionCounter = document.getElementById('question-counter');
questionCounter.innerHTML = `<h2>❤️ Final Result ❤️</h2>`;
// Hide the question and answers from the display
document.getElementById('question').style.display = 'none';
document.getElementById('answers').style.display = 'none';
// Display the final result in the result container
const resultContainer = document.getElementById('result');
const resultText = finalCharacter ? `Your result is: ${finalCharacter}!` : "No final character determined.";
resultContainer.innerHTML = `<h2>${resultText}</h2>`;
// Display the image for the final character, if one is determined
if (finalCharacter) {
const images = characterImageMap[finalCharacter];
if (images && images.length > 0) {
// Randomly select an image from the array
const randomIndex = Math.floor(Math.random() * images.length);
const selectedImage = images[randomIndex];
const image = document.createElement('img');
image.src = selectedImage;
image.alt = finalCharacter;
document.getElementById('result').appendChild(image);
} else {
console.log('No images found for ' + finalCharacter);
}
}
}
function displayQuestionFromGroup(groupKey, questionIndex) {
// Fetch the specific question from the group
const questionData = questionGroups[groupKey][questionIndex];
// Set up the question and answers
const questionContainer = document.getElementById('question');
const answersContainer = document.getElementById('answers');
questionContainer.innerHTML = `<h2>${questionData.questionText}</h2>`;
answersContainer.innerHTML = ''; // Clear previous answers
// Create buttons for each answer and attach the click event
questionData.answers.forEach(answer => {
const button = document.createElement('button');
button.textContent = answer.text;
button.addEventListener('click', () => {
handleAnswer(answer);
});
answersContainer.appendChild(button);
});
// Make sure to update the question count and displayed state as needed
questionCount++;
}
function displayQuestion10() {
if (currentGroupKey.startsWith('group')) {
let questionText = '';
let answers = [];
// Check which group's Question 10 to display
if (currentGroupKey.startsWith('group1')) {
questionText = "What kind of girl makes your heart skip a beat?";
answers = [
{ text: "Someone reserved and considerate", person: "Fuuka Yamagishi" },
{ text: "Overwhelming intellect", person: "Naoto Shirogane" },
{ text: "A healthy appetite", person: "Rei" },
];
} else if (currentGroupKey.startsWith('group2')) {
questionText = "Your preferred type in a nutshell?";
answers = [
{ text: "Youth that tries to act mature", person: "Ken Amada" },
{ text: "A pure heart", person: "Teddie" },
{ text: "Overwhelming adorableness", person: "Koromaru" },
];
} else if (currentGroupKey.startsWith('group3')) {
questionText = "What kind of partner are you secretly longing for?";
answers = [
{ text: "Sharp-tongued, yet lonely", person: "Yukari Takeba" },
{ text: "An energetic crybaby", person: "Chie Satonaka" },
{ text: "Abs of literal steel", person: "Aigis" },
];
} else if (currentGroupKey.startsWith('group4')) {
questionText = "Who would be your ideal soulmate?";
answers = [
{ text: "Somewhat disappointing good looks", person: "Yosuke Hanamura" },
{ text: "A knight who protects the weak", person: "Zen" },
{ text: "A gentle youngest of siblings", person: "Theodore" },
];
}
// Display the constructed Question 10
if (questionText && answers.length > 0) {
const questionContainer = document.getElementById('question');
const answersContainer = document.getElementById('answers');
questionContainer.innerHTML = `<h2>${questionText}</h2>`;
answersContainer.innerHTML = ''; // Clear previous answers
// Populate the answers
answers.forEach(answer => {
const button = document.createElement('button');
button.textContent = answer.text;
button.addEventListener('click', () => handleAnswer(answer));
answersContainer.appendChild(button);
});
questionCount = 10; // Manually set questionCount to 10 after displaying Question 10
}
}
}
// Adding the question counter element dynamically
const quizContainer = document.getElementById('quiz-container');
const counterElement = document.createElement('div');
counterElement.id = 'question-counter';
quizContainer.insertBefore(counterElement, quizContainer.firstChild);
// Start the quiz
displayQuestion();
</script>
</body>
</html>