Implemented in | Navigator 2.0, LiveWire 1.0 |
Syntax
function name([param] [, param] [..., param]) {
statements} Arguments
name | The function name. |
param | The name of an argument to be passed to the function. A function can have up to 255 arguments. |
Description
To return a value, the function must have a return
statement that specifies the value to return. You cannot nest a function statement in another statement or in itself.
All parameters are passed to functions, by value. In other words, the value is passed to the function, but if the function changes the value of the parameter, this change is not reflected globally or in the calling function.
In addition to defining functions as described here, you can also define Function
objects.
Examples
//This function returns the total dollar amount of sales, when
//given the number of units sold of products a, b, and c.
function calc_sales(units_a, units_b, units_c) {
return units_a*79 + units_b*129 + units_c*699
}
Last Updated: 10/31/97 12:29:59