Functions
JavaScript, like most programming languages, has facilities for creating subprograms to modularize or divide programs into distinct functions. When required, a function can be called to carry out a particular task.
JavaScript functions behave a little differently than you might expect:
• There is no value reference distinction
• There is no data type distinction
• Return values do not have data types and are optional
function max(a,b) // -- Multiple Returns
{
if (a > b)
return(a); // -- Return a because it is larger
else
return(b); // -- Return b because it is larger
}
To create and save a custom JavaScript function, see Script Library in Getting Started.
| << Switch Statement | © 1996-2013 InetSoft Technology Corporation (v11.4) | 2.4 Useful Text/String Functions >> |