Utilizor
Contact Us

Function Declaration

Defining functions with the function keyword.

Function Declaration

A function definition (also called a function declaration, or function statement) consists of the function keyword, followed by:

  • The name of the function.
  • A list of parameters to the function, enclosed in parentheses and separated by commas.
  • The JavaScript statements that define the function, enclosed in curly brackets, { }.

Example

function myFunction(p1, p2) {
  return p1 * p2;
}