Horje
quiz javascript example with array Code Example
quiz javascript example with array
var questions = [
["What is the capital of England?", "LONDON", "You know, where the queen lives"],
["What is the capital of France?", "PARIS", "Remember the eiffel tower?"],
["What is the capital of Canada?", "OTTAWA", "Lot of mooses there"]
];

var correctAnswers = 0;

for (var i = 0; i < questions.length; i++) {
    var answer = prompt(questions[i][0]);
    if (answer.toUpperCase() == questions[i][1]) {
        alert("Correct! " + questions[i][2]);
        correctAnswers++;
    }
    else {
        alert("incorrect, the correct answer was " + questions[i][1]);
    }
}




Javascript

Related
function return multiple values solidity Code Example function return multiple values solidity Code Example
download file from api response Code Example download file from api response Code Example
js how to have an onclick inside of another onClick Code Example js how to have an onclick inside of another onClick Code Example
add object to array react hook Code Example add object to array react hook Code Example
pandas json_normalize column with json array Code Example pandas json_normalize column with json array Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11