JavaScript Tutorial: Defining a Function

Function definition takes this form:

function funcName(arg1, arg2, ...) { ... }

A function may or may not have a “return” statement in the body. If it doesn't, its return value is undefined. Example:

function addOne(x) {return x+1;} //returns one more!

function printMissive(firstName)
{ document.write("<p>Dear "+firstName+",</p>")}

Reference: developer.mozilla.org ↗


See also:


Page created: 2005-05.
© 2005 by Xah Lee.
Xah Signet