Get Programming with JavaScript - Listing 11.11

Listing 11.11 - Improving the quiz app

var quiz = { questions: [ { question: "What is the highest mountain in the world?", answer: "Everest" }, { question: "What is the highest mountain in Scotland?", answer: "Ben Nevis" }, { question: "How many munros are in Scotland?", answer: "284" } ], qIndex: 0, quizMe: function () { return quiz.questions[quiz.qIndex].question; }, showMe: function () { return quiz.questions[quiz.qIndex].answer; }, next: function () { quiz.qIndex = quiz.qIndex + 1; return "Ok"; } };