A function is a block of statements that can be used repeatedly in a program.
A function will not execute immediately when a page loads.
A function will be executed by a call to the function.


A user defined function declaration starts with the word "function":

Syntax

Code:
function functionName()
{
code to be executed;
}

Note: A function name can start with a letter or underscore (not a number).
Tip: Give the function a name that reflects what the function does