Udostępnij za pośrednictwem


JScript Variables and Constants

In any programming language, data represents information. For example, this string literal contains a question:

'How old am I?'

Variables and constants store data that scripts can easily reference by using the name of the variable or constant. Data stored by a variable may change as a program runs, while data stored by a constant cannot change. A script that uses a variable actually accesses the data that the variable represents. Here is an example in which the variable named NumberOfDaysLeft is assigned the value derived from the difference between EndDate and TodaysDate.

NumberOfDaysLeft = EndDate – TodaysDate;

In a mechanical sense, a script uses variables to store, retrieve, and manipulate the values that appear in scripts. Constants reference data that that does not change. Always create a meaningful variable name to help you remember the variable's purpose and to help others determine the script's functionality.

In This Section

  • JScript Identifiers
    Explains how to create valid names for identifiers in JScript.

  • 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.

  • JScript Assignments and Equality
    Explains how JScript assigns values to variables, array elements, and property elements and explains the equality syntax used by JScript.

  • JScript Reference
    Lists elements that compose JScript Language Reference and links to topics that explain the details behind the proper use of language elements.