Variables are memory locations for any data of one and any data type. The memory locations are given a name and can be used directly in expressions and functions. Their value can be changed at any time in the script by new assignments.
A variable is automatically declared in JScript the first time it is used. However, it is cleaner to declare all used variables explicitly at the beginning of the script. The var instruction is used for this purpose.
Variable names are subject to the following rules:
- Distinction between upper and lower case
- Max. 255 characters long
- Only letters, digits and underscores have
- First character must be a capital or small letter
- Subsequent characters can be digits, letters and underscores (_)
- Variable name must not be a reserved word
Data type conversion
Variables are automatically converted to a suitable data type when they are combined or used in calculations.
For example, if the variable"a" contains the text "Monday" as value and the variable "b" contains the value 2, the variable "c" will contain the value "Montag2" as text if "c=a+b" is assigned.