Welcome back, my friends.
And today we're going to try to finish up the parking report.
For that reason, we are going to copy a couple of things right now.
First things first, I want to tell you here something.
So we grab the clinic patients using the map function and just put it here.
But this line is complete scene with this.
That's why I just modified that version in order to tell you, yeah, we can just delete this and use
this patients here.
And the result will not be changed here is saying we're going to have the same result, the smallest.
The largest.
Right.
2016 and 2020.
Same thing.
Same here.
That's why I use that one to just make our life easier so he can uncommented this one.
I mean, you can comment on this one
and you can just put the patience here, that's it right now for the parking report.
So if he comes along the parking parking, we will see these four different, right?
It will say parking, parking, address, everything here that we have done.
Price our size.
Your bill in full day, price in four spots in our spots.
OK, now the first function I want to create here is called to just calculate the parking data.
Right.
And we are going to create here a function called Colque.
And in this function, I'm going to pass in the parking data.
This actually I haven't created yet.
If I need to cancel, log this car.
So now if you go back, it will give you an error because this function is it's not there, actually.
Right.
It's not defined.
OK, now, before doing this, I just want to create that parking data, const parking data.
So what I want here, I'm going to use this parking that map.
So today we use this map a lot.
Now I'm just going to see current, right.
I'm going to say here with a comma, I'm going to create a little bit more complex area.
So I'm going to see current dot for spots.
Then I want to grab current dot.
How are these spots?
Right then I want the current that price and current price for the price.
Right.
So that comes a lot, this parking data
in common, this one because it's still going to give you an error.
Comes of love, right?
Is that going to work?
OK, now I did have four I one, two, three, four in each area do have the full Sports Authority spots,
three dollars or won our prize in full day price.
OK, and the same goes for this same go for this same school for this.
So just loop through all of it and I get from the current element of this from here.
All right.
Nice.
So I can easily create that code function.
So now I'm going to create this Colque function outside here.
Where we are, so clinics report, right, just going to create this here, their and it will say Colque
I'm going to pass it.
So what we need to pass here.
So we need to pass the data from before and make sure that you don't forget about the function.
Now, here, create this.
This will return the newest and oldest year.
And you can see me or me max value.
Right, because we are using the same one for finding I mean, max value.
OK, and this were we this will be the function for calculation, the parking, the O key.
Now here what I'm going to do, I'm going to say DataDot.
Data that for each so I'm going to look through each and every element here.
So I'm going to grab the element.
I'm going to use this error function right here, the curly brackets, because I'm going to have multiple
lines here.
Right.
So I'm going to say full parking here, but before one just comes over.
Are the element in because we are consuming a lot of the element, we just need to call it here.
OK, now I do have the same thing.
Good, I don't need this one anymore.
Very good.
So what I will do, I'm just going to create a couple of variables here for sorry, not VAR Alisi left
here, full parking.
And that will be equal to zero, so I'm going to declare an initialise in the same line.
So if we haven't done this now, it's the Shad's so full, hourly, hourly, and that will be again
to zero then for income.
That again, to be a zero comma to make sure you put in commandeers hourly income.
That will be zero as well.
And now I can use this.
So for the full parking, what I'm going to do on Thursday, plus equal element of zero.
OK, so I'm going to do all of this.
And after that I'm going to explain what they're doing right.
So full hourly here and it will be element of one.
Right.
So this is the element of zero, this is the element of one, so I just want to look through each of
these and grab the 60 28 for the hourly for the full parking.
I just want to look through these four areas and grab the zero positions.
Right in the zero position is 90 here.
The zero position is 100, then the 80 to 76 coupe.
Now I do have full income.
So the Fullenkamp will be the element of zero.
I need to multiply by the nine where the element of three.
So the element that is in the position three right this hour, the nine, it's always these three and
nine.
They are everywhere.
So I can easily know that the position position zero, he's going to be full time, first of all, all
day parking and this will be the old price.
Nice now for you.
So we'll see hourly income and that will be this.
Sixty, twenty, eighty four.
Eighty four multiplied by three.
Three, three, three.
All right.
That's element of too good.
Now what we need to do is I'm going to tell you what we need to return.
You return all of these values.
So I'm going to return Eigg of full parking now, but I will say EVGA hourly parking, that will be
the second variable that I'm going to return to Fool Parking's.
This speed man's four spot, total hourly parking, S.P., full income in hourly income, good now eroded
this because I will know what I need to write, what I need to grab it from here.
Right.
Because see, if I don't use this after that, when I do comes along here, things I will not know which
which way, because I'm going to use again the structuring and I will not know which variable contains
what value.
I just need to connect them.
OK, so I'm going to return an area of full parking.
Good karma then.
The average is actually theta that length.
So I'm going to divide it by datalink in here.
I'm going to see for the second one it will be full hourly divided by data that length.
Yet what else?
I do have to make sure that this is good.
Now we are done with the average.
So I'm going to say full parking full hourly.
The full income here, hourly income.
That's good.
Okey dokey.
In here, if I know I need to cancel work in order to see what we return.
Right.
Because we don't have anything.
Here is eighty six.
Sixty six three.
Forty six to six.
Four and the rest.
OK, now I'm going to stop with this using the restructuring.
So what I'm going to story, so I need to begin to create all of these variables so I'm not going to
bother you too much again, what you need to do is to use these JS file here every year.
He saying that it's coming from the desktop.
And what I'm going to do is just going to grab some parts.
Or let's close this one.
So I'm just going to copy the entire thing until the number six, actually this because we do have the
parking data, this I'm doing because I don't want to waste your time and I don't want to sound too
boring for you.
OK, so go back here.
I don't need this, but I need and also I don't need this.
OK, now maybe I did need that.
OK, so create full parking average, average, total parking, two parking spots, income.
This is total parking income.
This is total hourly parking income in that Kalik of the parking meter.
No.
Yeah, actually, let's save it and see if anything will break now in our four Daniel colleagues, we
have approximately of this.
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
these simple things.
We're not doing anything special here.
We just bringing out the results that we already did from that calculation.
And you and I have shown you how we can do this right now.
One more thing you need to do here is to finding the parking that has more.
So the last one was the finding, the parking that passed more than one hundred hourly or all the spots.
So how we can do this?
OK, so I'm going to create a concept called the index.
Index full, this means a full parking spot and I will see parking that map in here, I'm going to grab
every element for the current.
So we have used current before so you can use the current element.
Doesn't matter.
So the current element that I'm going to say 11. for spots now if I cassella
index.
Should be indexed F, let's see what we have.
OK, we're on top, so I have nineteen hundred eighty seventy six.
So where is this coming from?
OK, Fusspot.
So the food spots are this nineteen hundred eighty, sixty seventy six.
And this is the other spots.
Right.
This is the earliest part and these are the total.
So 90 plus 60 will be one hundred and fifty twenty plus a hundred.
It will be one hundred and twenty one hundred plus eighty twenty.
Right good.
Now we grab all this we story in, we create inventory, we store them with the help of the map method.
No we first time we're going to use to find index remember defined index.
We still have access to this element in with the Therrell function we can say OK which of the element
is greater and equal that one hundred and it will go through this list and it will give me back this
one index.
Right.
So if I save it now, this index of one it will have one index of F it will have one.
Good.
Now easily what I can do, I can say console log and I'm going to write this one now.
I'm going to say seven and what I'm going to say parking's of that index of one that address some will
be able to grab the address now has more than or equal to sorry, equal to a hundred.
All the parking spots.
Q Now, I'm just going to copy it here again.
Actually, I'm not going to copy it, but just because I did copy that, I'm just going to come into
that.
OK, no registry has more than a hundred.
Let's go here.
Here is Brother Street has more than one hundred more equal to good.
Let's find the other one.
So I'm just going to copy this entire let's do it step by step, because I want to show you an index
of Suheir hourly.
And I will say, Parkin's, I'm going to use again the math method.
He and I have the axis of the current element and I'm going to grab all of these hourly spots.
Right.
So if I do cancel a lot of the index of H, I don't know what is happening right now.
Okay.
Now and I'm also.
Yeah.
So I have sixty, twenty, one hundred and eighty four and this is coming from sixty, twenty, one
hundred and eighty four.
So I do have these hourly parking's.
So what I want now I just want to see the same thing, I'm just going to copy it, put it here.
Good.
And now I don't need this uncommon.
This.
Good, and I need to change it to number eight instead of index of every index of hourly addresses more
than or equal to and in our case, which will be that this will be Dockland Street.
Cool, nice.
Show that is working, so for homework, I want you to use the scene here, get me and Max function
in fine because we do have a year of built.
Right.
And I want you to find the parking that is the newest parking and the oldest park.
So that is simply we can just call this function and bring out the entire up into the console of the
entire result.
Right.
I'm not going to do it for you.
That is too simple and that is pretty much it.
We have covered everything for this project.
I mean, for this challenge.
And I hope you like it.
You can just return a little bit because the video do something on your own and this will be included
in your
I'm not sure how I'm going to include it.
I'm going to say here a final version improved.
Right.
So this is going to be the improved.
So don't worry, we're not sure because I've created one more method that wasn't intentionally there,
and this one was that one.
So we use here, we return an array of errors and here we just use it.
The other one.
All right, good.
Now, let's see.
I will see you in the next section.
And in that section, we will learn more advanced things.
And I cannot wait to start that section because that section will blow your mind.
OK.
Thanks.