1 00:00:00,630 --> 00:00:09,630 Hello and welcome to the part two of this functionality for the app using JavaScript. 2 00:00:09,630 --> 00:00:17,400 I have added a chunk of code here from line 92 to a hundred and twelve. 3 00:00:17,400 --> 00:00:29,750 This function here will display the current question and the choices so line 94. 4 00:00:29,840 --> 00:00:33,750 I'm doing a console log and I passed it in. 5 00:00:33,750 --> 00:00:35,670 Display core in question. 6 00:00:35,770 --> 00:00:41,170 So when the current question is displayed it will show it on the console on the screen. 7 00:00:41,230 --> 00:00:44,000 Line 96 declare the variable here. 8 00:00:44,030 --> 00:00:54,130 Call question and set it to course two questions and then passed it hand array of current question dot 9 00:00:54,170 --> 00:00:55,050 question. 10 00:00:55,300 --> 00:00:59,240 So that's a high res so you pick up the questions from that array. 11 00:00:59,320 --> 00:01:06,210 We remember we we defined a variable at the very beginning core questions. 12 00:01:06,270 --> 00:01:07,190 Okay. 13 00:01:07,450 --> 00:01:10,210 So we also defined some more variables here. 14 00:01:10,220 --> 00:01:16,800 Line 55 will go a variable called current question and we'll got one called current answer. 15 00:01:16,810 --> 00:01:20,860 So those are the variables is referring to. 16 00:01:20,930 --> 00:01:21,400 All right. 17 00:01:21,410 --> 00:01:27,460 So when you say says variable question equals two questions which is that variable. 18 00:01:27,460 --> 00:01:30,670 And it's past it current question. 19 00:01:30,670 --> 00:01:32,760 Got a question variable. 20 00:01:32,860 --> 00:01:37,050 Question class again equals two. 21 00:01:37,160 --> 00:01:38,530 Do you see a dollar sign. 22 00:01:38,560 --> 00:01:38,800 J. 23 00:01:38,800 --> 00:01:41,440 Query in close to this method. 24 00:01:41,530 --> 00:01:42,920 Again he picks up the. 25 00:01:42,970 --> 00:01:48,150 This is the container contained under wraps it not quiz container. 26 00:01:48,610 --> 00:01:58,710 If say if this quiz container is greater than the question then 98 ways of choices. 27 00:01:58,750 --> 00:02:01,080 The variable code choices again. 28 00:02:01,180 --> 00:02:06,760 If that method dot quiz is greater than choice list. 29 00:02:06,850 --> 00:02:10,150 These are what the more the various variables have been defined. 30 00:02:10,270 --> 00:02:14,020 And these are the values here. 31 00:02:14,260 --> 00:02:18,370 We're using this here to set the question. 32 00:02:18,370 --> 00:02:18,990 Class. 33 00:02:19,060 --> 00:02:19,590 Okay. 34 00:02:19,630 --> 00:02:22,920 This here is a comment I've just put here. 35 00:02:22,930 --> 00:02:23,650 Question. 36 00:02:23,680 --> 00:02:26,210 Class the text or question. 37 00:02:26,290 --> 00:02:31,070 This will remove all current ally elements. 38 00:02:31,090 --> 00:02:32,280 If there is any. 39 00:02:32,320 --> 00:02:32,660 Okay. 40 00:02:32,680 --> 00:02:33,780 That's what this means. 41 00:02:33,790 --> 00:02:42,010 Choice to find a lie and then remove them here variable one of several variable choice. 42 00:02:42,010 --> 00:02:43,210 Who got a loop here. 43 00:02:43,210 --> 00:02:44,950 Same for high. 44 00:02:44,980 --> 00:02:53,240 If the first value close to zero and the eye is less than the number of choices then increase. 45 00:02:53,450 --> 00:02:56,490 I increase the question by 1. 46 00:02:56,530 --> 00:03:01,960 If the choice is equal to the questions current questions or choices you pass through the eye which 47 00:03:01,960 --> 00:03:07,030 is the represents the I act as a counter who represents 1. 48 00:03:07,060 --> 00:03:15,700 So here again we we're using the dollar sign on this the airline list using the airline is list to impute 49 00:03:16,880 --> 00:03:25,270 a radio button and cancel it to the radio button each time a choice is made and then it appends it to 50 00:03:25,270 --> 00:03:26,170 the list. 51 00:03:26,200 --> 00:03:26,570 OK. 52 00:03:26,590 --> 00:03:31,760 Want to choices is made you appends it to the list. 53 00:03:31,900 --> 00:03:38,080 The final function I've added here is from line one hundred and twelve two hundred and twenty five is 54 00:03:38,170 --> 00:03:45,290 a function called Reset quizzes function will reset the quiz and enable you to start a game. 55 00:03:45,580 --> 00:03:48,240 So the leaves are. 56 00:03:48,250 --> 00:03:51,640 This is what will happen when the quiz is reset. 57 00:03:51,820 --> 00:03:57,310 The current question if the save the current question is close to zero correct is of course to zero 58 00:03:57,760 --> 00:03:59,410 it will hide the score. 59 00:03:59,410 --> 00:04:00,700 It will call this function. 60 00:04:00,700 --> 00:04:07,180 This function is called function or method called high score so it will hide the score and then will 61 00:04:07,180 --> 00:04:08,400 go here. 62 00:04:08,420 --> 00:04:16,090 Another function function called displaced function here would display the score is saying if the document 63 00:04:16,090 --> 00:04:21,890 are fine the quiz container is greater than the result. 64 00:04:22,040 --> 00:04:31,670 The text then it displays this text to see you scored x and x amount plus correctly display what you 65 00:04:32,020 --> 00:04:41,020 do display that text that says you scored plus the correct answers you've answered plus out of question 66 00:04:41,020 --> 00:04:46,830 for example you say you scored five out of is called you scored. 67 00:04:46,840 --> 00:04:51,620 So for example four questions out of eight okay. 68 00:04:51,850 --> 00:04:53,470 That's what that means. 69 00:04:53,470 --> 00:04:57,000 And then it does the same thing and then it shows the results. 70 00:04:57,010 --> 00:05:04,570 Using this show method it shows the results here after I displays that then we've got a function called 71 00:05:04,570 --> 00:05:06,100 Hide score. 72 00:05:06,100 --> 00:05:12,310 This will use a document of fine result and it will hide the results. 73 00:05:12,550 --> 00:05:17,440 So all these functions will be used at various parts of the code. 74 00:05:17,590 --> 00:05:22,480 So that's all the code for the functionality for the quiz. 75 00:05:23,320 --> 00:05:27,630 If you have any please let me know. 76 00:05:27,750 --> 00:05:31,340 So these are all the code whether any parts of it you don't understand. 77 00:05:31,340 --> 00:05:32,620 Please let me know. 78 00:05:32,690 --> 00:05:33,960 So last set. 79 00:05:33,960 --> 00:05:35,010 Thanks for watching. 80 00:05:35,010 --> 00:05:35,820 Bye for now.