ADONIS
Reference Manual
×
Menu
Index
Variables
 
Identifiers:
JavaScript variables are containers for storing data values. All JavaScript variables must be identified with unique names. These unique names are called identifiers. Identifiers can be short names (like x and y) or more descriptive names (area, dist, totalVolume). The general rules for constructing names for variables (unique identifiers) are:
1. Names can contain letters, digits, underscores, and dollar signs.
2. Names must begin with a letter
3. Names can also begin with $ and _
4. Names are case sensitive (y and Y are different variables)
5. Reserved words (like JavaScript keywords) cannot be used as names
 
Operator:
In JavaScript, the equal sign (=) is an "assignment" operator, not an "equal to" operator.
 
Data Types:
JavaScript variables can hold numbers like 100 and text values like "elastic". JavaScript can handle many types of data, but for now, just think of numbers and strings. Strings are written inside double or single quotes. Numbers are written without quotes. If you put a number in quotes, it will be treated as a text string.
 
Example:
var x = 5;
var y = 6;
var z = x + y;
 
var model;
model = "elastic";
 
var model = "elastic", name = "sand", density = 125;
The help manual was created with Dr.Explain