The purpose of using a function is to take advantage of reusable code-block that will be executed by an event, or when the function is called.It's purpose is to perform a single task or a series of task.
As mentioned earlier, functions
Functions are declared using the reserved word function followed by the name of the function, and an opening and closing bracket used for parameters. The code for these function begin after the open curly bracket and end with a closing curly bracket.
Functions can be called: