Home | Javascript validator | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.
Microsoft® JScript®
function Statement
 Language Reference 
Version 1 

See Also


Description
Declares a new function.
Syntax
function functionname([argument1 [, argument2 [, ...argumentn]]])
{
   statements
}

The function statement syntax has the following parts:

Part Description
functionname The name of the function.
argument1...argumentn An optional, comma-separated list of arguments the function understands.
statements One or more JavaScript statements.

Remarks
Use the function statement to declare a function for later use. The code contained in statements is not executed until the function is called from elsewhere in the script.

The following example illustrates the use of the function statement:

function myfunction(arg1, arg2)
{
  var r;
  r = arg1 * arg2;
  return(r);
}

Note  When calling a function, ensure that you always include the parentheses and any required arguments. Calling a function without parentheses causes the text of the function to be returned instead of the results of the function.


Home | Javascript validator | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.