The Foundation
Functions are the main " subroutines " in JavaScript. They allow us to avoid code duplication.
Syntax
function name(parameters) {
...body...
}
Calling a Function
function showMessage() {
alert('Hello everyone!');
}
showMessage(); // Call
showMessage(); // Another call
Note
The main feature of a Function Declaration is that it can be called BEFORE it is defined in the code. This is possible due to the " hoisting " mechanism.