Welcome back to the continuation of creating a function.
So in this video let's have a look at why do we need a function.
So for what we have done as we talk about why we need a function, if this function is performing,
why if any function then you would take us correct?
Otherwise we say no.
Have a look.
Well, the PDF, the slides.
Everything will be provided for us.
So don't worry.
Just understand what you are doing.
Okay.
So one functions helps to make your code more readable so that this function makes a code readable.
Yes, because sometimes if you refer to X and Y, what does it mean as you mean this function?
We don't have the function here like before we declare verbal like A and b x is code.
This you don't know what x is.
X can be let's say somebodies name.
It can be a theory, it can be somebody's nickname, it can be whatever.
But with function it makes our code more readable.
Meaning that for this function, if look at a name, it tells you that we are adding something together.
So if inside this one it tells you that well, we are adding X means number one.
And number two, that is first point.
So this function is correct.
You meet the first requirement and a requirement is that functions can make your code more usable.
Well, when we say more reasonable, what does it mean?
Meaning that I can reference any way I want my message to be appeared.
I will make our core dysfunction anyway.
My code and I have access to it.
So does this one solve it?
I can say that it's solved only let's say three over ten for now because we haven't finished the function
yet.
That's why we talk about parameters and argument.
After you going through that, then you're going to get ten over ten for this function that you created.
So function mean is to be what, reusable?
That's a good point.
Next point is that function can help make your code maintainable again.
Once it maintainable simply means that if you run out that we are writing this code, you you understand
what is doing over here.
But let's say that after ten years or 20 years and you take the same code because, oh, my gosh, what
was the meaning of this one was even of X.
But as soon as we see the name or the function is that, oh, this function is doing this.
So maintaining that function is really easy.
So this function also meets that perfect.
Next one is that function can improve the performance of your code.
Well, this is advanced level part of because when it comes to Y JavaScript, Y JavaScript, I mean
run behind the scene.
If you get a function, it is to go into the memory of JavaScript by that is advanced part.
Don't worry about that.
So this one, I'll give it as question mark.
The next part is that functions can help to modernize your code.
Meaning.
We can copy certain certain code together at one place to mobilize it.
The next one is that it.
Is this more it helps for?
Testing and improved testing.
That was an advanced part of it.
So in short, functions should be reusable, meaning it can any way I want I can just visit and then
a function might contain a piece of logic in your application.
But right now we don't have all those things that our function is doing right now.
So in this video, let's talk about parameters and argument.
And then after that, we talk about what is called return keyword.
After you go through that, then a function, the whole of this.
Why a function?
This particular function we meet.
So let's see in the next video, guys.