JScript functions can perform actions, return values, or both. For example, a function could display the current time and return a string that represents the time. Functions are also called global methods.
Functions combine several operations under one name, which makes code streamlined and reusable. You can write a set of statements, name it, and then execute the entire set by calling its name and passing to it the necessary information.
To pass information to a function, enclose the information in parentheses after the name of the function. Pieces of information that are passed to a function are called arguments or parameters. Some functions do not take arguments, while others take one or more arguments. In some functions, the number of arguments depends on how you are using the function.
JScript supports two kinds of functions, those that are built into the language and those that you create.