Share via


JScript Identifiers

In JScript, identifiers are used to:

  • name variables, constants, functions, classes, interfaces, and enumerations

  • provide labels for loops (not used very often).

Using identifiers

JScript is a case-sensitive language. Consequently, a variable named myCounter is different from a variable named MyCounter. Variable names can be of any length. The rules for creating valid variable names are as follows:

  • The first character must be a Unicode letter (either uppercase or lowercase) or an underscore (_) character. Note that a number cannot be used as the first character.

  • Subsequent characters must be letters, numbers, or underscores.

  • The variable name must not be a reserved word.

Here are some examples of valid identifiers:

_pagecount 
Part9 
Number_Items 

Here are some examples of invalid identifiers:

99Balloons // Cannot begin with a number. 
Smith&Wesson // The ampersand (&) character is not a valid character for variable names. 

When choosing identifiers, avoid JScript reserved words and words that are already the names of intrinsic JScript objects or functions, such as String or parseInt.

See Also

Concepts

JScript Reserved Words (Visual Studio - JScript)

Other Resources

JScript Variables and Constants

JScript Functions

JScript Objects