1 00:00:02,810 --> 00:00:03,650 Welcome back, my friends. 2 00:00:03,680 --> 00:00:07,790 And today we're going to try to finish up the parking report. 3 00:00:08,480 --> 00:00:12,950 For that reason, we are going to copy a couple of things right now. 4 00:00:12,980 --> 00:00:16,490 First things first, I want to tell you here something. 5 00:00:16,850 --> 00:00:22,480 So we grab the clinic patients using the map function and just put it here. 6 00:00:22,790 --> 00:00:28,030 But this line is complete scene with this. 7 00:00:28,940 --> 00:00:35,240 That's why I just modified that version in order to tell you, yeah, we can just delete this and use 8 00:00:35,240 --> 00:00:36,530 this patients here. 9 00:00:37,460 --> 00:00:45,980 And the result will not be changed here is saying we're going to have the same result, the smallest. 10 00:00:46,130 --> 00:00:47,240 The largest. 11 00:00:48,080 --> 00:00:48,470 Right. 12 00:00:48,650 --> 00:00:50,650 2016 and 2020. 13 00:00:50,680 --> 00:00:51,290 Same thing. 14 00:00:51,290 --> 00:00:51,840 Same here. 15 00:00:52,400 --> 00:00:59,900 That's why I use that one to just make our life easier so he can uncommented this one. 16 00:01:02,180 --> 00:01:03,560 I mean, you can comment on this one 17 00:01:06,260 --> 00:01:14,120 and you can just put the patience here, that's it right now for the parking report. 18 00:01:14,480 --> 00:01:26,180 So if he comes along the parking parking, we will see these four different, right? 19 00:01:27,340 --> 00:01:32,120 It will say parking, parking, address, everything here that we have done. 20 00:01:32,240 --> 00:01:33,970 Price our size. 21 00:01:34,190 --> 00:01:38,910 Your bill in full day, price in four spots in our spots. 22 00:01:38,950 --> 00:01:46,040 OK, now the first function I want to create here is called to just calculate the parking data. 23 00:01:46,370 --> 00:01:46,720 Right. 24 00:01:46,940 --> 00:01:54,200 And we are going to create here a function called Colque. 25 00:01:56,330 --> 00:01:59,160 And in this function, I'm going to pass in the parking data. 26 00:01:59,570 --> 00:02:01,700 This actually I haven't created yet. 27 00:02:02,180 --> 00:02:06,740 If I need to cancel, log this car. 28 00:02:06,790 --> 00:02:13,940 So now if you go back, it will give you an error because this function is it's not there, actually. 29 00:02:13,940 --> 00:02:14,250 Right. 30 00:02:14,450 --> 00:02:15,230 It's not defined. 31 00:02:15,750 --> 00:02:22,460 OK, now, before doing this, I just want to create that parking data, const parking data. 32 00:02:23,120 --> 00:02:26,150 So what I want here, I'm going to use this parking that map. 33 00:02:26,490 --> 00:02:28,730 So today we use this map a lot. 34 00:02:29,120 --> 00:02:32,600 Now I'm just going to see current, right. 35 00:02:32,960 --> 00:02:40,840 I'm going to say here with a comma, I'm going to create a little bit more complex area. 36 00:02:40,850 --> 00:02:44,480 So I'm going to see current dot for spots. 37 00:02:46,040 --> 00:02:48,580 Then I want to grab current dot. 38 00:02:49,160 --> 00:02:52,180 How are these spots? 39 00:02:52,190 --> 00:03:00,740 Right then I want the current that price and current price for the price. 40 00:03:00,740 --> 00:03:01,020 Right. 41 00:03:01,790 --> 00:03:06,980 So that comes a lot, this parking data 42 00:03:09,590 --> 00:03:12,500 in common, this one because it's still going to give you an error. 43 00:03:16,940 --> 00:03:18,240 Comes of love, right? 44 00:03:20,300 --> 00:03:20,930 Is that going to work? 45 00:03:21,140 --> 00:03:30,870 OK, now I did have four I one, two, three, four in each area do have the full Sports Authority spots, 46 00:03:30,920 --> 00:03:35,450 three dollars or won our prize in full day price. 47 00:03:35,670 --> 00:03:40,050 OK, and the same goes for this same go for this same school for this. 48 00:03:40,060 --> 00:03:48,050 So just loop through all of it and I get from the current element of this from here. 49 00:03:48,680 --> 00:03:48,970 All right. 50 00:03:49,250 --> 00:03:49,670 Nice. 51 00:03:51,050 --> 00:03:55,220 So I can easily create that code function. 52 00:03:55,410 --> 00:03:58,880 So now I'm going to create this Colque function outside here. 53 00:04:01,280 --> 00:04:12,110 Where we are, so clinics report, right, just going to create this here, their and it will say Colque 54 00:04:13,190 --> 00:04:14,330 I'm going to pass it. 55 00:04:14,400 --> 00:04:15,880 So what we need to pass here. 56 00:04:17,810 --> 00:04:23,270 So we need to pass the data from before and make sure that you don't forget about the function. 57 00:04:23,510 --> 00:04:26,390 Now, here, create this. 58 00:04:28,040 --> 00:04:36,380 This will return the newest and oldest year. 59 00:04:37,100 --> 00:04:43,010 And you can see me or me max value. 60 00:04:43,550 --> 00:04:46,880 Right, because we are using the same one for finding I mean, max value. 61 00:04:46,910 --> 00:04:59,090 OK, and this were we this will be the function for calculation, the parking, the O key. 62 00:04:59,480 --> 00:05:02,840 Now here what I'm going to do, I'm going to say DataDot. 63 00:05:04,710 --> 00:05:09,070 Data that for each so I'm going to look through each and every element here. 64 00:05:09,960 --> 00:05:11,120 So I'm going to grab the element. 65 00:05:11,460 --> 00:05:16,980 I'm going to use this error function right here, the curly brackets, because I'm going to have multiple 66 00:05:16,980 --> 00:05:17,730 lines here. 67 00:05:18,000 --> 00:05:18,350 Right. 68 00:05:18,410 --> 00:05:23,520 So I'm going to say full parking here, but before one just comes over. 69 00:05:31,440 --> 00:05:37,140 Are the element in because we are consuming a lot of the element, we just need to call it here. 70 00:05:42,580 --> 00:05:44,780 OK, now I do have the same thing. 71 00:05:45,220 --> 00:05:47,320 Good, I don't need this one anymore. 72 00:05:48,220 --> 00:05:48,780 Very good. 73 00:05:48,970 --> 00:05:56,950 So what I will do, I'm just going to create a couple of variables here for sorry, not VAR Alisi left 74 00:05:56,950 --> 00:05:58,660 here, full parking. 75 00:06:02,050 --> 00:06:06,730 And that will be equal to zero, so I'm going to declare an initialise in the same line. 76 00:06:07,000 --> 00:06:14,590 So if we haven't done this now, it's the Shad's so full, hourly, hourly, and that will be again 77 00:06:14,590 --> 00:06:16,870 to zero then for income. 78 00:06:17,440 --> 00:06:24,750 That again, to be a zero comma to make sure you put in commandeers hourly income. 79 00:06:24,760 --> 00:06:26,500 That will be zero as well. 80 00:06:27,100 --> 00:06:29,800 And now I can use this. 81 00:06:30,730 --> 00:06:39,330 So for the full parking, what I'm going to do on Thursday, plus equal element of zero. 82 00:06:39,710 --> 00:06:41,980 OK, so I'm going to do all of this. 83 00:06:43,510 --> 00:06:46,030 And after that I'm going to explain what they're doing right. 84 00:06:46,210 --> 00:06:51,670 So full hourly here and it will be element of one. 85 00:06:53,560 --> 00:06:53,930 Right. 86 00:06:53,950 --> 00:06:59,050 So this is the element of zero, this is the element of one, so I just want to look through each of 87 00:06:59,050 --> 00:07:05,220 these and grab the 60 28 for the hourly for the full parking. 88 00:07:05,230 --> 00:07:09,510 I just want to look through these four areas and grab the zero positions. 89 00:07:09,520 --> 00:07:12,220 Right in the zero position is 90 here. 90 00:07:12,220 --> 00:07:16,760 The zero position is 100, then the 80 to 76 coupe. 91 00:07:17,470 --> 00:07:19,600 Now I do have full income. 92 00:07:21,810 --> 00:07:25,800 So the Fullenkamp will be the element of zero. 93 00:07:26,900 --> 00:07:32,190 I need to multiply by the nine where the element of three. 94 00:07:32,490 --> 00:07:38,790 So the element that is in the position three right this hour, the nine, it's always these three and 95 00:07:38,790 --> 00:07:39,180 nine. 96 00:07:39,180 --> 00:07:40,460 They are everywhere. 97 00:07:40,710 --> 00:07:47,250 So I can easily know that the position position zero, he's going to be full time, first of all, all 98 00:07:47,250 --> 00:07:50,340 day parking and this will be the old price. 99 00:07:50,560 --> 00:07:53,180 Nice now for you. 100 00:07:53,940 --> 00:07:59,940 So we'll see hourly income and that will be this. 101 00:08:00,570 --> 00:08:02,600 Sixty, twenty, eighty four. 102 00:08:02,610 --> 00:08:04,650 Eighty four multiplied by three. 103 00:08:04,650 --> 00:08:05,580 Three, three, three. 104 00:08:06,000 --> 00:08:06,420 All right. 105 00:08:08,430 --> 00:08:11,740 That's element of too good. 106 00:08:12,270 --> 00:08:15,810 Now what we need to do is I'm going to tell you what we need to return. 107 00:08:15,820 --> 00:08:19,410 You return all of these values. 108 00:08:20,310 --> 00:08:31,500 So I'm going to return Eigg of full parking now, but I will say EVGA hourly parking, that will be 109 00:08:31,500 --> 00:08:37,380 the second variable that I'm going to return to Fool Parking's. 110 00:08:39,890 --> 00:08:53,540 This speed man's four spot, total hourly parking, S.P., full income in hourly income, good now eroded 111 00:08:53,540 --> 00:08:58,600 this because I will know what I need to write, what I need to grab it from here. 112 00:08:58,730 --> 00:08:59,180 Right. 113 00:08:59,960 --> 00:09:07,010 Because see, if I don't use this after that, when I do comes along here, things I will not know which 114 00:09:07,640 --> 00:09:13,340 which way, because I'm going to use again the structuring and I will not know which variable contains 115 00:09:13,370 --> 00:09:14,000 what value. 116 00:09:14,570 --> 00:09:15,720 I just need to connect them. 117 00:09:16,060 --> 00:09:20,300 OK, so I'm going to return an area of full parking. 118 00:09:20,870 --> 00:09:22,700 Good karma then. 119 00:09:24,020 --> 00:09:27,830 The average is actually theta that length. 120 00:09:28,040 --> 00:09:30,770 So I'm going to divide it by datalink in here. 121 00:09:30,770 --> 00:09:36,800 I'm going to see for the second one it will be full hourly divided by data that length. 122 00:09:38,930 --> 00:09:40,220 Yet what else? 123 00:09:40,220 --> 00:09:42,830 I do have to make sure that this is good. 124 00:09:44,480 --> 00:09:47,000 Now we are done with the average. 125 00:09:47,180 --> 00:09:51,680 So I'm going to say full parking full hourly. 126 00:09:52,310 --> 00:09:57,160 The full income here, hourly income. 127 00:09:57,350 --> 00:09:58,580 That's good. 128 00:09:59,150 --> 00:10:00,350 Okey dokey. 129 00:10:00,620 --> 00:10:11,300 In here, if I know I need to cancel work in order to see what we return. 130 00:10:11,930 --> 00:10:12,250 Right. 131 00:10:12,320 --> 00:10:14,780 Because we don't have anything. 132 00:10:14,780 --> 00:10:16,160 Here is eighty six. 133 00:10:16,280 --> 00:10:17,360 Sixty six three. 134 00:10:17,390 --> 00:10:19,160 Forty six to six. 135 00:10:19,160 --> 00:10:21,140 Four and the rest. 136 00:10:21,650 --> 00:10:26,240 OK, now I'm going to stop with this using the restructuring. 137 00:10:30,630 --> 00:10:36,720 So what I'm going to story, so I need to begin to create all of these variables so I'm not going to 138 00:10:36,720 --> 00:10:46,720 bother you too much again, what you need to do is to use these JS file here every year. 139 00:10:47,560 --> 00:10:49,670 He saying that it's coming from the desktop. 140 00:10:50,500 --> 00:10:54,420 And what I'm going to do is just going to grab some parts. 141 00:10:56,330 --> 00:10:57,400 Or let's close this one. 142 00:10:59,110 --> 00:11:07,450 So I'm just going to copy the entire thing until the number six, actually this because we do have the 143 00:11:07,450 --> 00:11:14,260 parking data, this I'm doing because I don't want to waste your time and I don't want to sound too 144 00:11:14,260 --> 00:11:15,080 boring for you. 145 00:11:16,840 --> 00:11:18,080 OK, so go back here. 146 00:11:19,060 --> 00:11:23,200 I don't need this, but I need and also I don't need this. 147 00:11:23,980 --> 00:11:27,700 OK, now maybe I did need that. 148 00:11:31,890 --> 00:11:38,860 OK, so create full parking average, average, total parking, two parking spots, income. 149 00:11:38,910 --> 00:11:40,370 This is total parking income. 150 00:11:40,380 --> 00:11:45,530 This is total hourly parking income in that Kalik of the parking meter. 151 00:11:45,780 --> 00:11:46,230 No. 152 00:11:49,590 --> 00:11:56,400 Yeah, actually, let's save it and see if anything will break now in our four Daniel colleagues, we 153 00:11:56,400 --> 00:11:57,750 have approximately of this. 154 00:11:57,930 --> 00:12:05,070 So I'm not going to the reason why I just use the other F.J. is because I don't want you to teach you 155 00:12:05,070 --> 00:12:06,060 these simple things. 156 00:12:06,060 --> 00:12:07,830 We're not doing anything special here. 157 00:12:07,980 --> 00:12:13,410 We just bringing out the results that we already did from that calculation. 158 00:12:13,410 --> 00:12:17,660 And you and I have shown you how we can do this right now. 159 00:12:17,670 --> 00:12:24,090 One more thing you need to do here is to finding the parking that has more. 160 00:12:25,920 --> 00:12:41,290 So the last one was the finding, the parking that passed more than one hundred hourly or all the spots. 161 00:12:42,630 --> 00:12:43,650 So how we can do this? 162 00:12:43,910 --> 00:12:47,790 OK, so I'm going to create a concept called the index. 163 00:12:49,920 --> 00:12:59,280 Index full, this means a full parking spot and I will see parking that map in here, I'm going to grab 164 00:13:00,060 --> 00:13:02,400 every element for the current. 165 00:13:03,570 --> 00:13:08,040 So we have used current before so you can use the current element. 166 00:13:08,050 --> 00:13:08,700 Doesn't matter. 167 00:13:09,000 --> 00:13:16,500 So the current element that I'm going to say 11. for spots now if I cassella 168 00:13:18,810 --> 00:13:19,500 index. 169 00:13:22,440 --> 00:13:26,470 Should be indexed F, let's see what we have. 170 00:13:26,490 --> 00:13:31,380 OK, we're on top, so I have nineteen hundred eighty seventy six. 171 00:13:31,500 --> 00:13:33,810 So where is this coming from? 172 00:13:34,170 --> 00:13:35,670 OK, Fusspot. 173 00:13:35,910 --> 00:13:42,270 So the food spots are this nineteen hundred eighty, sixty seventy six. 174 00:13:42,270 --> 00:13:44,610 And this is the other spots. 175 00:13:44,820 --> 00:13:45,150 Right. 176 00:13:45,340 --> 00:13:48,020 This is the earliest part and these are the total. 177 00:13:48,210 --> 00:13:52,260 So 90 plus 60 will be one hundred and fifty twenty plus a hundred. 178 00:13:52,440 --> 00:13:56,700 It will be one hundred and twenty one hundred plus eighty twenty. 179 00:13:56,730 --> 00:13:58,710 Right good. 180 00:13:59,010 --> 00:14:08,670 Now we grab all this we story in, we create inventory, we store them with the help of the map method. 181 00:14:09,030 --> 00:14:14,590 No we first time we're going to use to find index remember defined index. 182 00:14:14,790 --> 00:14:21,420 We still have access to this element in with the Therrell function we can say OK which of the element 183 00:14:21,420 --> 00:14:28,320 is greater and equal that one hundred and it will go through this list and it will give me back this 184 00:14:28,320 --> 00:14:29,430 one index. 185 00:14:29,880 --> 00:14:30,260 Right. 186 00:14:30,420 --> 00:14:38,520 So if I save it now, this index of one it will have one index of F it will have one. 187 00:14:39,030 --> 00:14:39,360 Good. 188 00:14:40,410 --> 00:14:48,720 Now easily what I can do, I can say console log and I'm going to write this one now. 189 00:14:48,900 --> 00:15:00,150 I'm going to say seven and what I'm going to say parking's of that index of one that address some will 190 00:15:00,150 --> 00:15:10,440 be able to grab the address now has more than or equal to sorry, equal to a hundred. 191 00:15:11,430 --> 00:15:15,420 All the parking spots. 192 00:15:16,430 --> 00:15:20,780 Q Now, I'm just going to copy it here again. 193 00:15:22,340 --> 00:15:27,950 Actually, I'm not going to copy it, but just because I did copy that, I'm just going to come into 194 00:15:27,950 --> 00:15:28,230 that. 195 00:15:28,400 --> 00:15:31,930 OK, no registry has more than a hundred. 196 00:15:32,690 --> 00:15:33,500 Let's go here. 197 00:15:36,380 --> 00:15:41,770 Here is Brother Street has more than one hundred more equal to good. 198 00:15:42,050 --> 00:15:42,990 Let's find the other one. 199 00:15:44,450 --> 00:15:51,620 So I'm just going to copy this entire let's do it step by step, because I want to show you an index 200 00:15:51,620 --> 00:15:55,040 of Suheir hourly. 201 00:15:55,040 --> 00:15:58,460 And I will say, Parkin's, I'm going to use again the math method. 202 00:15:58,730 --> 00:16:05,120 He and I have the axis of the current element and I'm going to grab all of these hourly spots. 203 00:16:06,220 --> 00:16:06,450 Right. 204 00:16:07,220 --> 00:16:18,560 So if I do cancel a lot of the index of H, I don't know what is happening right now. 205 00:16:18,780 --> 00:16:19,220 Okay. 206 00:16:19,560 --> 00:16:22,370 Now and I'm also. 207 00:16:22,520 --> 00:16:22,880 Yeah. 208 00:16:25,160 --> 00:16:32,480 So I have sixty, twenty, one hundred and eighty four and this is coming from sixty, twenty, one 209 00:16:32,480 --> 00:16:34,330 hundred and eighty four. 210 00:16:34,610 --> 00:16:36,650 So I do have these hourly parking's. 211 00:16:36,860 --> 00:16:41,630 So what I want now I just want to see the same thing, I'm just going to copy it, put it here. 212 00:16:41,900 --> 00:16:42,320 Good. 213 00:16:42,950 --> 00:16:46,400 And now I don't need this uncommon. 214 00:16:46,400 --> 00:16:46,820 This. 215 00:16:50,350 --> 00:16:59,050 Good, and I need to change it to number eight instead of index of every index of hourly addresses more 216 00:16:59,050 --> 00:17:05,710 than or equal to and in our case, which will be that this will be Dockland Street. 217 00:17:07,140 --> 00:17:08,540 Cool, nice. 218 00:17:08,550 --> 00:17:16,890 Show that is working, so for homework, I want you to use the scene here, get me and Max function 219 00:17:17,130 --> 00:17:22,350 in fine because we do have a year of built. 220 00:17:22,650 --> 00:17:22,980 Right. 221 00:17:23,130 --> 00:17:27,850 And I want you to find the parking that is the newest parking and the oldest park. 222 00:17:27,990 --> 00:17:34,440 So that is simply we can just call this function and bring out the entire up into the console of the 223 00:17:34,440 --> 00:17:35,170 entire result. 224 00:17:35,580 --> 00:17:35,940 Right. 225 00:17:35,970 --> 00:17:37,040 I'm not going to do it for you. 226 00:17:37,350 --> 00:17:40,330 That is too simple and that is pretty much it. 227 00:17:40,360 --> 00:17:45,480 We have covered everything for this project. 228 00:17:45,480 --> 00:17:47,580 I mean, for this challenge. 229 00:17:47,790 --> 00:17:49,140 And I hope you like it. 230 00:17:49,140 --> 00:17:56,970 You can just return a little bit because the video do something on your own and this will be included 231 00:17:57,360 --> 00:17:58,470 in your 232 00:18:01,020 --> 00:18:02,730 I'm not sure how I'm going to include it. 233 00:18:02,730 --> 00:18:07,820 I'm going to say here a final version improved. 234 00:18:08,070 --> 00:18:08,430 Right. 235 00:18:08,640 --> 00:18:10,420 So this is going to be the improved. 236 00:18:10,440 --> 00:18:16,380 So don't worry, we're not sure because I've created one more method that wasn't intentionally there, 237 00:18:16,380 --> 00:18:19,080 and this one was that one. 238 00:18:19,090 --> 00:18:25,970 So we use here, we return an array of errors and here we just use it. 239 00:18:26,220 --> 00:18:26,820 The other one. 240 00:18:26,980 --> 00:18:28,000 All right, good. 241 00:18:28,470 --> 00:18:30,400 Now, let's see. 242 00:18:30,540 --> 00:18:32,160 I will see you in the next section. 243 00:18:32,160 --> 00:18:36,120 And in that section, we will learn more advanced things. 244 00:18:36,120 --> 00:18:41,280 And I cannot wait to start that section because that section will blow your mind. 245 00:18:41,490 --> 00:18:41,800 OK. 246 00:18:41,950 --> 00:18:42,390 Thanks.