Over the last lectures,
I spent a lot of time on functions
because functions are a super crucial and key feature
which you will need all the time in JavaScript development
and that's why you need to understand them.
And I hope I could explain those key basics.
We are going to write and use a lot of functions
throughout this course so you will get a lot of practice,
but the general idea should be clear by now.
I wanna emphasize again that functions don't need to return
and don't need to take parameters.
It will depend on which kind of function you're writing
and what it's doing.
I also wanna emphasize again that functions of course
can execute multiple steps in there
and you can of course also introduce variables in there,
like result, which then are only available in this function.
And then here we could store userAge minus 18 and result
and return the value stored and the result here.
That would be an alternative way of writing this function,
arguably an unnecessarily complex way,
but to understand that you can do
all these things and functions,
I want to switch to that code for now.
So which code goes into a function?
And whether you return and/or whether you use parameters
depends on what your function does.
As I said, we're going to write many functions
throughout this course,
and therefore there will be plenty of opportunities
to practice this.
This is the general feature of functions.
That's how it generally works.
And now let's build up on that.