Java Reference
In-Depth Information
We also need to update the ask() function to use the question object notation instead of
array notation:
scripts.js (excerpt)
function ask(question) {
return prompt(quiz.question + question); // this line
changes
}
The following line in the check() function also needs to be changed:
scripts.js (excerpt)
if(answer === quiz.questions[i].answer){
Save these changes then have a go at playing the game again. Once again, we haven't ac-
tually added any functionality, but we have started to make the program more modular by
storing all the quiz information in a separate object. This will make it easier to expand on
the functionality in later chapters
Search WWH ::




Custom Search