1 00:00:00,380 --> 00:00:03,520 It's time to put what you've learned about arrays into practice. 2 00:00:03,520 --> 00:00:06,120 In this exercise, you will build a quiz app. 3 00:00:06,120 --> 00:00:10,660 And the first part of this challenge, the app will ask a series of questions and 4 00:00:10,660 --> 00:00:12,410 evaluate each answer. 5 00:00:12,410 --> 00:00:16,110 The program keeps track of the number of questions answered correctly. 6 00:00:16,110 --> 00:00:18,270 After the user answers all questions, 7 00:00:18,270 --> 00:00:21,530 the app displays the number of questions correctly answered. 8 00:00:21,530 --> 00:00:24,970 To get started, launch the new workspace with this video, or 9 00:00:24,970 --> 00:00:28,370 download the project files and use your preferred text editor. 10 00:00:28,370 --> 00:00:33,090 When you open the file quiz.js, you'll notice that it contains several JavaScript 11 00:00:33,090 --> 00:00:35,820 comments with instructions on what you'll need to do. 12 00:00:35,820 --> 00:00:38,690 You'll use some of the concepts from this course to complete this challenge. 13 00:00:39,930 --> 00:00:43,640 First, you'll need to create a multidimensional array 14 00:00:43,640 --> 00:00:46,280 to hold the questions and answers. 15 00:00:46,280 --> 00:00:49,926 Each element of the array represents one question and 16 00:00:49,926 --> 00:00:54,878 is itself an array composed of two elements, the question and the answer. 17 00:00:54,878 --> 00:00:58,950 Create a two-dimensional array with at least three questions in it. 18 00:00:58,950 --> 00:01:00,830 You'll also need to store and 19 00:01:00,830 --> 00:01:04,240 keep track of the number of questions answered correctly. 20 00:01:04,240 --> 00:01:08,690 Then you'll need to use a loop to cycle through each question presented to 21 00:01:08,690 --> 00:01:13,610 the user and compare the response from the user to the answer in the array. 22 00:01:13,610 --> 00:01:17,180 You can, for example, use the prompt method to ask the questions. 23 00:01:17,180 --> 00:01:20,990 And you can use a conditional statement to check if the user's answer 24 00:01:20,990 --> 00:01:23,210 matches the correct answer. 25 00:01:23,210 --> 00:01:24,140 When the loop ends, 26 00:01:24,140 --> 00:01:28,360 your program should have kept track of how many questions were correctly answered. 27 00:01:28,360 --> 00:01:32,250 So you'll need to display the number of correct answers to the user. 28 00:01:32,250 --> 00:01:35,420 You can use the document.querySelector method 29 00:01:35,420 --> 00:01:40,970 to select the main element of index.html and display the final message. 30 00:01:40,970 --> 00:01:45,004 In the next video, I'll show you one solution to this challenge, good luck.