return; statement is not necessary. Functions can be defined in three ways:
- using the constructor of the Function object
- by function declaration
- by function expression
The code sample above shows 3 different methods for declaring a function. As mentioned above, each function has a name that describes its purpose. The functions are called using the method name and a set of parenthesis. The most common way of creating a method is through function declaration. This is the ideal method as the statements inside the functions are clearly shown along with the parameters (if any).