Completion requirements
function keyword
Syntax
The expression is not allowed at the start of a statement.
function (param0) { statements } function (param0, param1) { statements } function (param0, param1, /* … ,*/ paramN) { statements } function name(param0) { statements } function name(param0, param1) { statements } function name(param0, param1, /* … ,*/ paramN) { statements }
As of ES2015, you can also use arrow functions.
Parameters
name
(Optional)-
The function name. Can be omitted, in which case the function is anonymous. The name is only local to the function body.
paramN
(Optional)-
The name of an argument to be passed to the function.
statements
(Optional)-
The statements which comprise the body of the function.