JavaScript Editor Ajax toolkit     Ajax website 



Main Page

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.

In This Section

Type Annotation

Describes the concept of type annotation and how to use it in a function definition to control the input and output data types.

User-Defined JScript Functions

Illustrates how to define new functions in JScript and how to use them.

Recursion

Explains the concept of recursion and illustrates how to write recursive functions.

Related Sections

JScript Operators

Lists the computational, logical, bitwise, assignment, and miscellaneous operators and provides links to information that explains how to use them efficiently.

JScript Data Types

Includes links to topics that explain how to use primitive data types, reference data types, and .NET Framework data types in JScript.

Coercion in JScript

Explains the concept of coercion, how to use it, and the limitations of coercion.

function Statement

Describes the syntax for declaring functions.



JavaScript Editor Ajax toolkit     Ajax website


©