Welcome :)

WHAT IS A FUNCTION?
Functions let you group a series of statements together to perform a specific task. If different parts of a script repeat the same task, you can reuse the function (rather than repeating the same set of statements).
Declaring functions
To create a Function, you give it a name and then write the statements needed to achieve its task inside the curly braces. This is known as a Function declaration
You declare a function using the function keyword.
You give the function a name (somettimes calles in identifier) followed by parentheses.
The statements that perform the task sit in a code block. (they are inside curly braces.)

Calling Function
Having declared the function, you can thenn execute all of the statements between its curly braves with just one line of code. This is known as calling the function.
To run the code in the function, you use the function name folloed by parentheses.
In programmer-speak, you would say that this code calls a function.
You can call the same function as many times as you want within the same JavaScript file.

To learn more visit Link