JavaScript functions
Up to now, we write code in our script in such a way that will be executed or run once. Even with the construction of a loop, we define a loop, that runs multiple times but we can't execute this code:
1. Whenever we want
2. More than once
It seems that functions give us the opportunity to GROUP our code into a specific block and give a name to this block. Then any time we want this block of code to be executed and run we can just simply call it by it's own name. If we call this block more than once, it will run more than once.
Thus we keep code, organized, grouped by the task it performs, separately from other code, cleaner and reusable.
Let's take a look at how.