Welcome back.
In this lecture, we are going to call the functions that we created.
I hope we understand what we have done in these functions, right.
So this Substring actually had some links here that I would show to you, but I don't know what happened.
The browser crashed and that was for math, not abstract function JavaScript.
And this is from Developer Musila.
You can read it here.
Right.
So these returns, the absolute value of a number.
You can read more.
And there are actually a couple of nice examples.
Right.
So when we have a string that is minus one is actually going to return an absolute number, that will
be one.
This we're going to return to the note.
This an empty area.
It will return always zero in this here.
Not applique, not a number.
OK, now that is what I'm trying to do.
And also
substring.
We use that one.
You can read it if you want more.
But actually, I have read three schools.
They have nice example here and you can read using JavaScript string substring method.
So they're similar, but they're not the same.
Right.
OK, that's pretty much it.
Those were the two lectures that I want to show to you now here.
Just common.
This sport we don't need we don't need these kinds of luck.
You can delete it.
Oh, I will delete it from here.
Right.
I will delete this one from here.
I just want my code to be a little bit cleaner.
Right.
And I'm just going to delete that one and that one because there is nothing, no importance.
So I hope you understand it.
This first part.
It is it is mandatory.
You need to pass in here.
The second part is optional.
If you don't put it the whole string, the whole number or string will be returned.
And this is starting from zero and this is the link minus three.
And actually we just go from zero and minus three.
So actually one of two one space, right.
When we have two thousand.
Now the other one, you just this is just exactly the same.
But this guy here, we put it in front and actually we're doing OK.
Start from third position going from if you count it from right, left and just go there, bam, that's
it.
Now, one more thing here.
You need to put a variable in variable here.
Good.
Now we will be able to use them.
We will use this function.
We will call them in an item.
So where are we going to call in here?
These formant format calories.
I'm going to base them here.
OK, nice.
Oops.
It's not working now.
It's not for there I have I you so salad one five fifty point five oh.
Let's add one thousand five hundred fifty.
Cool.
Now go back here.
You will see only this ugly little here and you will see this one.
Right.
This is something we didn't want to happen but we still haven't used.
We still we haven't used the actual function and here it is.
We use the function for here.
Now I know something that this should be plus here and probably we do have.
OK, we do have somewhere for the calories we need to add the plus there, right cool is for the burn.
We should have the minus.
Check that one.
Here it is.
It's all good working.
Now, let's add this bad boy here somewhere else.
So formate calories.
I'm just going to copy it.
So we are going and I'm going to hold and I'm going to paste that here.
Also, I can be able to select both of them to save it.
Now, I should be able to see yet here is even the zero is with two decimal places.
But let's test it out.
So let's say salad is one one thousand two hundred thirty five point sixty five.
Enter.
Go back here.
Here is the comma.
Here is the two decimal spaces in this ugly here.
Even here, it's a little bit overflowing.
That's why I'm going to round it up.
Let's test for the exercise room one.
We're going to use the same one for now, a little bit less.
It's not possible yet.
Burn that it's going it's looking very promising.
So if you click on exercise, you should give you that one, the minus.
OK, nice.
So what else we need to do here?
Because I use sixty five.
Sixty five.
That's why it's here, the whole thing.
So if I add for example if I run in, if I said one sixty five only now I have a different result.
This guy here.
OK, let's fix that one.
So where are we going to call this one, you know in here in this display front calories.
But the remaining aegeus here.
So we have the remaining in this if OK.
Yeah, here it is.
I use only one here.
I was trying to do something.
I'm just going to remove it.
Right.
Don't get critical here.
Don't just judge me.
I did try to do something.
It didn't work the first time.
So I'm just going to hold the I select something else all the old and like that one and I'm going to
say format remaining OK in here.
I'm just going to close all of them.
So that's it.
That's the beauty of holding out now.
Here it is.
So I hope when we put decimals now it's going to work.
So let's food one one thousand three hundred twenty five point fifty sixty five enter.
It is no decimal, even if you do some other crazy exercise like one and let's say here thirty eight
and say exercise, click, exercise, enter, and that's pretty much it.
Let's go back here and we do have this nicely formatted number when we when we have like thousands with
a comma.
Right.
Cuz everything is working.
I hope you had a good day and I will see you in the next hour.
Just wait, let me just delete things and see if everything is back to normal, ok.
Yeah.
And I'm going to delete that one.
That one.
You know why gave us that result.
Because we're doing absolute things, ok.
Doesn't matter.
Now that's pretty much it for this lecture.
I'm not going to delete all of this just so you can comment the console.
OK, that's it.
Maybe I'll do it in a final lecture for the next lecture.
I will see what we will do.
We have a couple of things left, some short I mean, small things.
They will be short, shorter lectures.
But yeah, we need to do them as well.
So thank you very much.
I hope I will see you in the next one and enjoy.