Control flow refers to the order the computer will execute the flow of your statements in your script. Typically, control flow will flow from the first line to the last. A control flow consist of various structures like functions, loops, and conditional statements.
Functions are a block of code created to complete a specific task. Functions are activated when it is invoked or called. Functions are useful because developers are able to reuse a piece of code multiple times.
To create a function beign by typing the keyword ‘function’ followed by the name you would like to call the function in parentheses(). Functions include parameters that also included in parentheses. Next, would be the actual code syntax that needs to be executed, this code is surrounded by brackets.
Example:
function(function name)(parameters goes here if any) {
(code to be executed goes here);
}