JSFiddle - React, Tailwind, and code Playground
JavaScript
var gameScore = 0;
var quizQuestions = [
['What is the national sport in Japan', 'sumo wrestling'],
['What was the Olympic city in 1992', 'barcelona spain'],
['Who was the champion of the Tour de France from 1999 to 2005', 'lance armstrong'],
['Which cyclist was also called the cannibal', 'eddy merckx'],
['What do you call a Yoga posture', 'asana']
];
for (i = 0; i < quizQuestions.length; i += 1) {
var questions = prompt(quizQuestions[i][0]);
if (questions === quizQuestions[i][1]) {
gameScore += 1;
}
}
function print(message) {
document.write(message);
}
print('Youve got ' + gameScore + ' right!');